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

SQL_IF_EXISTS breaks CREATE OR REPLACE

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6, 10.11, 11.4, 11.8, 12.3, 10.5.29
    • 10.11, 11.4, 11.8, 12.3
    • Variables
    • None

    Description

      The option sql_if_exists is documented as follows:

      If set to 1, adds an implicit IF EXISTS to ALTER, RENAME and DROP of TABLES, VIEWS, FUNCTIONS and PACKAGES. This variable is mainly used in replication to tag DDLs that can be ignored on the slave if the target table doesn't exist.

      So, according to the description, it should have no effect on CREATE at all, and shouldn't anyhow prevent CREATE OR REPLACE. But it does:

      create table t (a int);
      set sql_if_exists = on;
       
      create or replace table t (b int);
       
      drop table t;
      

      main 526f0765b3f961803919ec2c47074c5e029acbfb

      mysqltest: At line 4: query 'create or replace table t (b int)' failed: ER_TABLE_EXISTS_ERROR (1050): Table 't' already exists
      

      Same on all versions back to early 10.5.

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.