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

          midenok Aleksey Midenkov added a comment - - edited

          Related to Making existing columns be system fields wrong behavior

          First error

          #0  my_error (nr=4141, MyFlags=0) at /home/midenok/src/mariadb/trunk/src/mysys/my_error.c:113
          #1  0x0000000000aa6f0e in Vers_parse_info::fix_alter_info (this=0x7fffe526a550, thd=0x7fff80000d50, alter_info=0x7fffe526a360, create_info=0x7fffe526a408, table=0x7fff800b6db0) at /home/midenok/src/mariadb/trunk/src/sql/handler.cc:7195
          #2  0x00000000008458ad in mysql_alter_table (thd=0x7fff80000d50, new_db=0x7fff800161f8 "test", new_name=0x0, create_info=0x7fffe526a408, table_list=0x7fff80015bc0, alter_info=0x7fffe526a360, order_num=0, order=0x0, ignore=false) at /home/midenok/src/mariadb/trunk/src/sql/sql_table.cc:9187
          #3  0x00000000008f1608 in Sql_cmd_alter_table::execute (this=0x7fff80016340, thd=0x7fff80000d50) at /home/midenok/src/mariadb/trunk/src/sql/sql_alter.cc:325
          #4  0x000000000074fd35 in mysql_execute_command (thd=0x7fff80000d50) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:6258
          #5  0x0000000000741a9f in mysql_parse (thd=0x7fff80000d50, rawbuf=0x7fff80015a48 "alter table t1 CHANGE COLUMN `vers_start` `sys_trx_start` TIMESTAMP(6) GENERATED ALWAYS AS ROW START", length=100, parser_state=0x7fffe526d650, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:7988
          

          Second error

          #0  my_error (nr=4138, MyFlags=0) at /home/midenok/src/mariadb/trunk/src/mysys/my_error.c:113
          #1  0x0000000000aa73a2 in Vers_parse_info::fix_alter_info (this=0x7fffe526a550, thd=0x7fff80000d50, alter_info=0x7fffe526a360, create_info=0x7fffe526a408, table=0x7fff800b6db0) at /home/midenok/src/mariadb/trunk/src/sql/handler.cc:7232
          #2  0x00000000008458ad in mysql_alter_table (thd=0x7fff80000d50, new_db=0x7fff800161f8 "test", new_name=0x0, create_info=0x7fffe526a408, table_list=0x7fff80015bc0, alter_info=0x7fffe526a360, order_num=0, order=0x0, ignore=false) at /home/midenok/src/mariadb/trunk/src/sql/sql_table.cc:9187
          #3  0x00000000008f1608 in Sql_cmd_alter_table::execute (this=0x7fff80016340, thd=0x7fff80000d50) at /home/midenok/src/mariadb/trunk/src/sql/sql_alter.cc:325
          #4  0x000000000074fd35 in mysql_execute_command (thd=0x7fff80000d50) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:6258
          #5  0x0000000000741a9f in mysql_parse (thd=0x7fff80000d50, rawbuf=0x7fff80015a48 "alter table t1 CHANGE COLUMN `vers_start` `sys_trx_start` TIMESTAMP(6) GENERATED ALWAYS AS ROW START", length=100, parser_state=0x7fffe526d650, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:7988
          

          Fix

          Second error should be processed first.

          midenok Aleksey Midenkov added a comment - - edited Related to Making existing columns be system fields wrong behavior First error #0 my_error (nr=4141, MyFlags=0) at /home/midenok/src/mariadb/trunk/src/mysys/my_error.c:113 #1 0x0000000000aa6f0e in Vers_parse_info::fix_alter_info (this=0x7fffe526a550, thd=0x7fff80000d50, alter_info=0x7fffe526a360, create_info=0x7fffe526a408, table=0x7fff800b6db0) at /home/midenok/src/mariadb/trunk/src/sql/handler.cc:7195 #2 0x00000000008458ad in mysql_alter_table (thd=0x7fff80000d50, new_db=0x7fff800161f8 "test", new_name=0x0, create_info=0x7fffe526a408, table_list=0x7fff80015bc0, alter_info=0x7fffe526a360, order_num=0, order=0x0, ignore=false) at /home/midenok/src/mariadb/trunk/src/sql/sql_table.cc:9187 #3 0x00000000008f1608 in Sql_cmd_alter_table::execute (this=0x7fff80016340, thd=0x7fff80000d50) at /home/midenok/src/mariadb/trunk/src/sql/sql_alter.cc:325 #4 0x000000000074fd35 in mysql_execute_command (thd=0x7fff80000d50) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:6258 #5 0x0000000000741a9f in mysql_parse (thd=0x7fff80000d50, rawbuf=0x7fff80015a48 "alter table t1 CHANGE COLUMN `vers_start` `sys_trx_start` TIMESTAMP(6) GENERATED ALWAYS AS ROW START", length=100, parser_state=0x7fffe526d650, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:7988 Second error #0 my_error (nr=4138, MyFlags=0) at /home/midenok/src/mariadb/trunk/src/mysys/my_error.c:113 #1 0x0000000000aa73a2 in Vers_parse_info::fix_alter_info (this=0x7fffe526a550, thd=0x7fff80000d50, alter_info=0x7fffe526a360, create_info=0x7fffe526a408, table=0x7fff800b6db0) at /home/midenok/src/mariadb/trunk/src/sql/handler.cc:7232 #2 0x00000000008458ad in mysql_alter_table (thd=0x7fff80000d50, new_db=0x7fff800161f8 "test", new_name=0x0, create_info=0x7fffe526a408, table_list=0x7fff80015bc0, alter_info=0x7fffe526a360, order_num=0, order=0x0, ignore=false) at /home/midenok/src/mariadb/trunk/src/sql/sql_table.cc:9187 #3 0x00000000008f1608 in Sql_cmd_alter_table::execute (this=0x7fff80016340, thd=0x7fff80000d50) at /home/midenok/src/mariadb/trunk/src/sql/sql_alter.cc:325 #4 0x000000000074fd35 in mysql_execute_command (thd=0x7fff80000d50) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:6258 #5 0x0000000000741a9f in mysql_parse (thd=0x7fff80000d50, rawbuf=0x7fff80015a48 "alter table t1 CHANGE COLUMN `vers_start` `sys_trx_start` TIMESTAMP(6) GENERATED ALWAYS AS ROW START", length=100, parser_state=0x7fffe526d650, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:7988 Fix Second error should be processed first.

          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.