tidb icon indicating copy to clipboard operation
tidb copied to clipboard

'create table if not exists ... like' doesn't work for existing table

Open bb7133 opened this issue 8 years ago • 2 comments

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
mysql> show tables;
+-------------------+
| Tables_in_ctwl_db |
+-------------------+
| t                 |
| t1                |
+-------------------+
2 rows in set (0.00 sec)

mysql> create table if not exists t like t1;
ERROR 1050 (42S01): Table 'ctwl_db.t' already exists
  1. What did you expect to see? KEYWORD 'if not exists' should work, TiDB should simply produce a 'NOTE' rather than 'ERROR'

  2. What did you see instead? As shown above

  3. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

mysql> select version();
+---------------------------------------+
| version()                             |
+---------------------------------------+
| 5.7.10-TiDB-v2.1.0-alpha-53-g5445ced7 |
+---------------------------------------+
1 row in set (0.00 sec)

bb7133 avatar Jun 22 '18 05:06 bb7133

@bb7133 Thank you for your feedback!

ciscoxll avatar Jun 22 '18 13:06 ciscoxll

 You want to see that like this:
mysql> create table if not exists t like t1;
Query OK, 0 rows affected, 1 warning (0.00 sec)

ciscoxll avatar Jun 22 '18 13:06 ciscoxll