apecloud / myduckserver

MySQL & Postgres Analytics, Reimagined
182 stars 8 forks source link

`COPY FROM DATABASE` Fails Due to Duplicate Table Error #170

Closed TianyuZhang1214 closed 2 days ago

TianyuZhang1214 commented 3 days ago

When executing the following command:

ATTACH 'dbname=postgres user=postgres password=root host=127.0.0.1 port=15432' AS pg_postgres (TYPE POSTGRES);
COPY FROM DATABASE pg_postgres TO mysql;

An error occurs:

ERROR:  Catalog Error: Table with name "my_table" already exists! (errno 1105) (sqlstate HY000)

It appears normal when using duckdb cli directly:

D ATTACH 'dbname=postgres user=postgres password=root host=127.0.0.1 port=15432' AS pg_postgres (TYPE POSTGRES);
D COPY FROM DATABASE pg_postgres TO cc;
D select * from cc.test_schema.test_table;
┌───────┬─────────┬───────┐
│  id   │  name   │  age  │
│ int32 │ varchar │ int32 │
├───────┼─────────┼───────┤
│     1 │ Alice   │    30 │
│     2 │ Bob     │    25 │
│     3 │ Charlie │    35 │
└───────┴─────────┴───────┘