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

ALTER and CREATE with default partitioning differently react to SQL_MODE => unusable SHOW CREATE

    XMLWordPrintable

Details

    Description

      With default SQL_MODE (which includes STRICT_TRANS_TABLES in all affected versions):

      --source include/have_partition.inc
       
      create table t (a int) with system versioning;
      alter table t partition by system_time partitions 3;
       
      show create table t;
      --let $show= query_get_value(show create table t, 'Create Table', 1)
       
      drop table t;
      --eval $show
       
      # Cleanup
      drop table if exists t;
      

      10.5

      MariaDB [test]> create table t (a int) with system versioning;
      Query OK, 0 rows affected (0.033 sec)
       
      MariaDB [test]> alter table t partition by system_time partitions 3;
      Query OK, 0 rows affected, 1 warning (0.084 sec)   
      Records: 0  Duplicates: 0  Warnings: 1
       
      MariaDB [test]> show warnings;
      +---------+------+----------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                          |
      +---------+------+----------------------------------------------------------------------------------+
      | Warning | 4115 | Maybe missing parameters: no rotation condition for multiple HISTORY partitions. |
      +---------+------+----------------------------------------------------------------------------------+
      1 row in set (0.000 sec)
      

      So, ALTER produces a warning, but still partitions the table:

      MariaDB [test]> show create table t;
      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                                        |
      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
      | t     | CREATE TABLE `t` (
        `a` int(11) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
       PARTITION BY SYSTEM_TIME 
      PARTITIONS 3 |
      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
      1 row in set (0.023 sec)
      

      Attempt to re-run this CREATE TABLE however leads to an error:

      MariaDB [test]> drop table t;
      Query OK, 0 rows affected (0.040 sec)
       
      MariaDB [test]> CREATE TABLE `t` (
          ->   `a` int(11) DEFAULT NULL
          -> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
          ->  PARTITION BY SYSTEM_TIME 
          -> PARTITIONS 3;
      ERROR 4115 (HY000): Maybe missing parameters: no rotation condition for multiple HISTORY partitions.
      

      Unsetting strict SQL mode makes it a warning again (notoriously, STRICT_TRANS_TABLES affects it, regardless whether it's InnoDB or MyISAM).

      Attachments

        Issue Links

          Activity

            People

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