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

Persistent virtual fields don't insert with auto_incremented fields

    XMLWordPrintable

Details

    Description

      MariaDB [testdb]> CREATE TABLE `cats` (
          ->   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
          ->   `name` varchar(255),
          ->   `full_nm` varchar(255) AS (TRIM(CONCAT(name, ' - ', id))) PERSISTENT,
          ->   `display_nm` varchar(255) AS (TRIM(CONCAT(name, ' - ', id))) VIRTUAL,
          ->     PRIMARY KEY (`id`)
          ->   ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
      Query OK, 0 rows affected (0.06 sec)
       
      MariaDB [testdb]> insert into cats (`name`) values ('freddy'), ('sammy'), ('spot'), ('boots');
      Query OK, 4 rows affected (0.00 sec)
      Records: 4  Duplicates: 0  Warnings: 0
       
      MariaDB [testdb]> select * from cats;
      +----+--------+------------+------------+
      | id | name   | full_nm    | display_nm |
      +----+--------+------------+------------+
      |  1 | freddy | freddy - 0 | freddy - 1 |
      |  2 | sammy  | sammy - 0  | sammy - 2  |
      |  3 | spot   | spot - 0   | spot - 3   |
      |  4 | boots  | boots - 0  | boots - 4  |
      +----+--------+------------+------------+
      4 rows in set (0.00 sec)

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              terrycullen Terry Cullen
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.