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

Possible redundancy in error codes: ER_VERS_GENERATED_ALWAYS_NOT_EMPTY vs ER_VERS_ALTER_SYSTEM_FIELD

Details

    Description

      If I attempt to change s system versioning column on a non-empty table, I get this:

      create or replace table t1 (i int, vers_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, vers_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME(vers_start,vers_end)) engine=MyISAM with system versioning;
      insert into t1 values (1);
      set versioning_alter_history=KEEP;
      alter table t1 CHANGE COLUMN `vers_start` `sys_trx_start` TIMESTAMP(6) GENERATED ALWAYS AS ROW START;
      

      ERROR 4140 (HY000): Can not modify column `vers_start` to GENERATED ALWAYS AS ROW START/END for non-empty table
      

      But if I do the same on an empty table, I still get an error:

      create or replace table t1 (i int, vers_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, vers_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME(vers_start,vers_end)) engine=MyISAM with system versioning;
      set versioning_alter_history=KEEP;
      alter table t1 CHANGE COLUMN `vers_start` `sys_trx_start` TIMESTAMP(6) GENERATED ALWAYS AS ROW START;
      

      ERROR 4137 (HY000): Can not change system versioning field `vers_start`
      

      So, the first error appears to be meaningless.

      Attachments

        Activity

          elenst Elena Stepanova created issue -
          elenst Elena Stepanova made changes -
          Field Original Value New Value
          Description If I attempt to change s system versioning column on a non-empty table, I get this:
          {code:sql}
          create or replace table t1 (i int, vers_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, vers_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME(vers_start,vers_end)) engine=MyISAM with system versioning;
          insert into t1 values (1);
          set versioning_alter_history=KEEP;
          MariaDB [test]> alter table t1 CHANGE COLUMN `vers_start` `sys_trx_start` TIMESTAMP(6) GENERATED ALWAYS AS ROW START;
          {code}
          {code:sql}
          ERROR 4140 (HY000): Can not modify column `vers_start` to GENERATED ALWAYS AS ROW START/END for non-empty table
          {code}

          But if I do the same on an empty table, I still get an error:
          {code:sql}
          create or replace table t1 (i int, vers_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, vers_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME(vers_start,vers_end)) engine=MyISAM with system versioning;
          set versioning_alter_history=KEEP;
          alter table t1 CHANGE COLUMN `vers_start` `sys_trx_start` TIMESTAMP(6) GENERATED ALWAYS AS ROW START;
          {code}
          {code:sql}
          ERROR 4137 (HY000): Can not change system versioning field `vers_start`
          {code}

          So, the first error appears to be meaningless.
          If I attempt to change s system versioning column on a non-empty table, I get this:
          {code:sql}
          create or replace table t1 (i int, vers_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, vers_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME(vers_start,vers_end)) engine=MyISAM with system versioning;
          insert into t1 values (1);
          set versioning_alter_history=KEEP;
          alter table t1 CHANGE COLUMN `vers_start` `sys_trx_start` TIMESTAMP(6) GENERATED ALWAYS AS ROW START;
          {code}
          {code:sql}
          ERROR 4140 (HY000): Can not modify column `vers_start` to GENERATED ALWAYS AS ROW START/END for non-empty table
          {code}

          But if I do the same on an empty table, I still get an error:
          {code:sql}
          create or replace table t1 (i int, vers_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, vers_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME(vers_start,vers_end)) engine=MyISAM with system versioning;
          set versioning_alter_history=KEEP;
          alter table t1 CHANGE COLUMN `vers_start` `sys_trx_start` TIMESTAMP(6) GENERATED ALWAYS AS ROW START;
          {code}
          {code:sql}
          ERROR 4137 (HY000): Can not change system versioning field `vers_start`
          {code}

          So, the first error appears to be meaningless.
          elenst Elena Stepanova made changes -
          Assignee Elena Stepanova [ elenst ] Aleksey Midenkov [ midenok ]
          elenst Elena Stepanova made changes -
          Assignee Aleksey Midenkov [ midenok ] Alexander Krizhanovsky [ krizhanovsky ]
          midenok Aleksey Midenkov made changes -
          Assignee Alexander Krizhanovsky [ krizhanovsky ] Aleksey Midenkov [ midenok ]
          midenok Aleksey Midenkov made changes -
          Fix Version/s 10.3.3 [ 22644 ]
          Fix Version/s 10.3 [ 22126 ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.3.4 [ 22904 ]
          Fix Version/s 10.3.3 [ 22644 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 84474 ] MariaDB v4 [ 153377 ]

          People

            midenok Aleksey Midenkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.