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

It's possible to make a system versioned table without any versioning field

Details

    Description

      Right behaviour looks like this.

      et @@system_versioning_alter_history=keep;
      create or replace table t (
      a int without system versioning
      ) with system versioning engine=innodb;
      versioning.kevg 'innodb'                 [ fail ]
              Test ended at 2018-06-14 21:32:40
       
      CURRENT_TEST: versioning.kevg
      mysqltest: At line 82: query 'create or replace table t (
      a int without system versioning
      ) with system versioning engine=innodb' failed: 4123: Table `t` must have at least one versioned column
      
      

      But it's possible to bypass this error with ALTER TABLE:

      set @@system_versioning_alter_history=keep;
      create or replace table t (
      a int
      ) with system versioning engine=innodb;
      alter table t
      change column a a int without system versioning;
      show create table t;
      Table	Create Table
      t	CREATE TABLE `t` (
        `a` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
      
      

      Same with trx_id based tables.

      Attachments

        Activity

          nikitamalyavin Nikita Malyavin added a comment - - edited

          This also crashes:

          set @@system_versioning_alter_history=keep;
          create or replace table t (a int) with system versioning engine=innodb;
          alter table t change column a a int without system versioning, drop system versioning;
           
          mysqld: ../sql/sql_table.cc:4436: bool vers_prepare_keys(THD*, HA_CREATE_INFO*, Alter_info*, KEY**, uint): Assertion `row_start_field' failed.
          

          nikitamalyavin Nikita Malyavin added a comment - - edited This also crashes: set @@system_versioning_alter_history=keep; create or replace table t (a int ) with system versioning engine=innodb; alter table t change column a a int without system versioning, drop system versioning;   mysqld: ../sql/sql_table.cc:4436: bool vers_prepare_keys(THD*, HA_CREATE_INFO*, Alter_info*, KEY **, uint): Assertion `row_start_field' failed.

          Both adding and removing system versioning for field while dropping system versioning for whole table will be forbidden with my upcoming patch.

          This might be documented as well.

          nikitamalyavin Nikita Malyavin added a comment - Both adding and removing system versioning for field while dropping system versioning for whole table will be forbidden with my upcoming patch. This might be documented as well.
          nikitamalyavin Nikita Malyavin added a comment - - edited

          Moving back on me — CREATE...SELECT could still be affected with current fix

          nikitamalyavin Nikita Malyavin added a comment - - edited Moving back on me — CREATE...SELECT could still be affected with current fix

          People

            nikitamalyavin Nikita Malyavin
            kevg Eugene Kosov (Inactive)
            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.