Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-5491 CREATE OR REPLACE TABLE
  3. MDEV-5519

CREATE OR REPLACE TABLE .. LIKE is allowed, but does not work as expected

    XMLWordPrintable

Details

    • Technical task
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • None
    • 10.0.8
    • None
    • None

    Description

      Syntax CREATE OR REPLACE TABLE foo LIKE bar is accepted, but it does actually not replace the table. If table `foo` already exists, it causes ER_TABLE_EXISTS_ERROR:

      MariaDB [test]> drop table if exists t1, t2;
      Query OK, 0 rows affected (0.35 sec)
       
      MariaDB [test]> create table t1 (i int);
      Query OK, 0 rows affected (1.61 sec)
       
      MariaDB [test]> create table t2 like t1;
      Query OK, 0 rows affected (1.67 sec)
       
      MariaDB [test]> create or replace table t2 like t1;
      ERROR 1050 (42S01): Table 't2' already exists

      revision-id: monty@askmonty.org-20140110153917-3r8owmbgslg2552n
      revno: 3965
      branch-nick: mariadb-monty

      Attachments

        Activity

          People

            monty Michael Widenius
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.