Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-20941

virtual column causes 2013 error upon insert

    XMLWordPrintable

    Details

      Description

      Using this table with virtual column 'trDomain' I'm experiencing no problems

      CREATE TABLE `sslinfo` (
      `domain` varchar(255) NOT NULL,
      `fromDate` datetime DEFAULT NULL,
      `toDate` datetime DEFAULT NULL,
      `ExpireInDays` smallint(4) unsigned GENERATED ALWAYS AS (to_days(`toDate`) - to_days(curdate())) VIRTUAL,
      `trDomain` varchar(255) GENERATED ALWAYS AS (concat('<tr data-color=\'',(to_days(`toDate`) - to_days(curdate())) DIV 20,'\'><td>',`domain`,'</td><td>',`fromDate`,'</td><td>',`toDate`,'</td><td>',`ExpireInDays`,'</td></tr>')) VIRTUAL, `shRenew` varchar(255) GENERATED ALWAYS AS (concat('./letsencrypt-auto --apache --force-renew certonly -n -d ',`domain`)) VIRTUAL,
      `shForceRenew` varchar(255) GENERATED ALWAYS AS (concat('certbot --apache --force-renew certonly -n -d ',`domain`,' --cert-name ',`domain`)) VIRTUAL,
      PRIMARY KEY (`domain`) USING BTREE,
      KEY `fromDate` (`fromDate`) USING BTREE
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;

      But when I change the column trDomain to:

      * `trDomain` varchar(255) GENERATED ALWAYS AS (concat('<tr data-color=\'',(to_days(`toDate`) - to_days(curdate())) DIV 20,'\'><td>',`domain`,'</td><td>',date_format(`fromDate`,'%Y-%m-%d %H:%i'),'</td><td>',date_format(`toDate`,'%Y-%m-%d %H:%i'),'</td><td>',`ExpireInDays`,'</td></tr>')) VIRTUAL,

      mariadb db gives a 2013 error upon insert.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            vincent.lemoine@iwa-consult.nl V H Lemoine
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: