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

CREATE OR REPLACE TABLE is less robust than DROP TABLE + CREATE TABLE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.5
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      Starting from 10.5, DROP TABLE works even if a .frm file is missing. But CREATE OR REPLACE TABLE doesn't:

      MariaDB [test]> CREATE TABLE x (a int);
      Query OK, 0 rows affected (0.009 sec)
       
      MariaDB [test]> \! ls -1 /var/lib/mysql/test/x.*
      /var/lib/mysql/test/x.frm
      /var/lib/mysql/test/x.ibd
      MariaDB [test]> \! rm /var/lib/mysql/test/x.frm
      MariaDB [test]> CREATE OR REPLACE TABLE x (a int);
      ERROR 1813 (HY000): Tablespace for table '`test`.`x`' exists. Please DISCARD the tablespace before IMPORT
      MariaDB [test]> DROP TABLE x;
      Query OK, 0 rows affected (0.006 sec)
      

      If this is not a bug, please consider it as a feature request.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              f_razzoli Federico Razzoli
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: