manticoresoftware / manticoresearch-buddy

Manticore Buddy is a Manticore Search's sidecar which helps it with various tasks
GNU General Public License v3.0
20 stars 2 forks source link

create table if not exists ... with data failed on table exists #325

Open donhardman opened 3 months ago

donhardman commented 3 months ago

Bug Description:

Here's an improved version of your text:

When we try to copy a table using CREATE TABLE ... LIKE ... [WITH DATA], we can't use the IF NOT EXISTS option.

Expected behavior: nothing happens (no error)

mysql> CREATE TABLE comment;
mysql> CREATE TABLE comment_1;
mysql> SHOW TABLES;
+------------------+------+
| Index            | Type |
+------------------+------+
| comment          | rt   |
| comment_1        | rt   |
+------------------+------+
mysql> CREATE TABLE comment_1 LIKE `comment` WITH DATA;
ERROR 1064 (42000): Destination table comment_1 already exists
mysql> CREATE TABLE IF NOT EXISTS comment_1 LIKE `comment` WITH DATA;
ERROR 1064 (42000): Destination table comment_1 already exists

Manticore Search Version:

Latest dev version

Operating System Version:

Ubuntu Jammy

Have you tried the latest development version?

Yes

Internal Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

- [x] Implementation completed - [ ] Tests developed - [x] Documentation updated - [x] Documentation reviewed - [x] Changelog updated
djklim87 commented 1 month ago

We don't support IF NOT EXISTS syntax for create with data syntax. @sanikolaev should we?

sanikolaev commented 1 month ago

Yes. IF NOT EXISTS and WITH DATA make sense together.

djklim87 commented 4 days ago

Waiting for review https://github.com/manticoresoftware/manticoresearch-buddy/pull/390

donhardman commented 1 day ago

Approved

djklim87 commented 1 day ago

Done in https://github.com/manticoresoftware/manticoresearch/commit/422c9785df2784344fbca85cbbbaeaf0c336d5fd

djklim87 commented 1 day ago

Docs updated in https://github.com/manticoresoftware/manticoresearch/commit/7b5999562998edb40823e3eb77fe97341702ba66

djklim87 commented 1 day ago

@PavelShilin89 You should update tests for create table with data to start checking is if not exists command works