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

    • Type: Technical task
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.0.8
    • Component/s: None
    • Labels:
      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

            • Assignee:
              monty Michael Widenius
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: