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

Persistent columns don't with with autoincrement

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.0.14
    • Fix Version/s: 10.0
    • Component/s: OTHER
    • Labels:

      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 |
      +-----+--------+------+
      

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                igor Igor Babaev
                Reporter:
                timbray Tim Bray
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: