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

Persistent columns don't with with autoincrement

    XMLWordPrintable

Details

    Description

      Persistent columns don't work if they are based on an auto increment column.

      CREATE TABLE `orgs` (
        `oid` int(11) unsigned NOT NULL AUTO_INCREMENT,
        `name` varchar(60) NOT NULL DEFAULT '',
        `oid2` int(11) unsigned as (`oid`) PERSISTENT,
        PRIMARY KEY (`oid`));
       
      insert into orgs ( name) values ('test 1'), ('test 2');

      MariaDB [tim_test]> select * from orgs;
      +-----+--------+------+
      | oid | name   | oid2 |
      +-----+--------+------+
      |   1 | test 1 |    0 |
      |   2 | test 2 |    0 |
      +-----+--------+------+

      I would expect the oid2 column to mirror the oid field.

      It works on update.

      update orgs set oid=5 where oid=2;

      MariaDB [tim_test]> select * from orgs;
      +-----+--------+------+
      | oid | name   | oid2 |
      +-----+--------+------+
      |   1 | test 1 |    0 |
      |   5 | test 2 |    5 |
      +-----+--------+------+

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              timbray Tim Bray
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.