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

Document difference between DEFAULT and 'DEFAULT' when setting alter_algorithm or system_versioning_asof

    XMLWordPrintable

Details

    Description

      When setting the session value of alter_algorithm to DEFAULT, it will not be set to the literal value DEFAULT, but will instead fetch whatever the current global value of the variable is. So unless the global value of the variable is also DEFAULT it is not possible to set the session value back to DEFAULT which is its default value.

      This can lead to rather confusing error messages on ALTER TABLE ...

      Same is true for system_versioning_asof where DEFAULT is also a valid literal value.

      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'alter_algorithm';
      +-----------------+---------+
      | Variable_name   | Value   |
      +-----------------+---------+
      | alter_algorithm | DEFAULT |
      +-----------------+---------+
       
      MariaDB [(none)]> SHOW SESSION VARIABLES LIKE 'alter_algorithm';
      +-----------------+---------+
      | Variable_name   | Value   |
      +-----------------+---------+
      | alter_algorithm | DEFAULT |
      +-----------------+---------+
       
      MariaDB [(none)]> SET GLOBAL alter_algorithm=COPY;
       
      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'alter_algorithm';
      +-----------------+-------+
      | Variable_name   | Value |
      +-----------------+-------+
      | alter_algorithm | COPY  |
      +-----------------+-------+
       
      MariaDB [(none)]> SHOW SESSION VARIABLES LIKE 'alter_algorithm';
      +-----------------+---------+
      | Variable_name   | Value   |
      +-----------------+---------+
      | alter_algorithm | DEFAULT |
      +-----------------+---------+
       
      MariaDB [(none)]> SET SESSION alter_algorithm=DEFAULT;
       
      MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'alter_algorithm';
      +-----------------+-------+
      | Variable_name   | Value |
      +-----------------+-------+
      | alter_algorithm | COPY  |
      +-----------------+-------+
       
      MariaDB [(none)]> SHOW SESSION VARIABLES LIKE 'alter_algorithm';
      +-----------------+-------+
      | Variable_name   | Value |
      +-----------------+-------+
      | alter_algorithm | COPY  |
      +-----------------+-------+
       
      MariaDB [test]> SET SESSION alter_algorithm='DEFAULT';
      Query OK, 0 rows affected (0.000 sec)
       
      MariaDB [test]> SHOW GLOBAL VARIABLES LIKE 'alter_algorithm';
      +-----------------+-------+
      | Variable_name   | Value |
      +-----------------+-------+
      | alter_algorithm | COPY  |
      +-----------------+-------+
      1 row in set (0.002 sec)
       
      MariaDB [test]> SHOW SESSION VARIABLES LIKE 'alter_algorithm';
      +-----------------+---------+
      | Variable_name   | Value   |
      +-----------------+---------+
      | alter_algorithm | DEFAULT |
      +-----------------+---------+
      1 row in set (0.002 sec)
      
      

      Attachments

        Issue Links

          Activity

            People

              JoeCotellese Joe Cotellese (Inactive)
              hholzgra Hartmut Holzgraefe
              Votes:
              0 Vote for this issue
              Watchers:
              7 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.