Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't copy between 2 Postgres databases using COPY FROM DATABASE #266

Open
2 tasks done
anikoo-aka opened this issue Sep 20, 2024 · 2 comments
Open
2 tasks done

Can't copy between 2 Postgres databases using COPY FROM DATABASE #266

anikoo-aka opened this issue Sep 20, 2024 · 2 comments

Comments

@anikoo-aka
Copy link

What happens?

I have attached 2 Postgres databases (PG14 and PG15) and able to run queries on both databases. PG15 database is empty and does not have any tables. When I run the following statement, I get an error:

COPY FROM DATABASE pg14 TO  pg15;
Invalid Error: Failed to execute query "CREATE INDEX orders_pkey ON public.orders()": ERROR:  syntax error at or near ")"
LINE 1: CREATE INDEX orders_pkey ON public.orders()
                                                  ^

D show orders;
┌──────────────┬───────────────┬─────────┬─────────┬─────────┬─────────┐
│ column_name  │  column_type  │  null   │   key   │ default │  extra  │
│   varchar    │    varchar    │ varchar │ varchar │ varchar │ varchar │
├──────────────┼───────────────┼─────────┼─────────┼─────────┼─────────┤
│ order_id     │ INTEGER       │ NO      │ PRI     │         │         │
│ customer_id  │ INTEGER       │ YES     │         │         │         │
│ order_date   │ DATE          │ YES     │         │         │         │
│ product_id   │ INTEGER       │ YES     │         │         │         │
│ notes        │ VARCHAR       │ YES     │         │         │         │
│ total_amount │ DECIMAL(10,2) │ YES     │         │         │         │
└──────────────┴───────────────┴─────────┴─────────┴─────────┴─────────┘

I tried to copy the schema only using the query below and got the same error:

COPY FROM DATABASE pg14 TO  pg15 (SCHEMA);

To Reproduce

Create the same table with the same table structure and try copying between 2 postgres hosts.

OS:

macOS

PostgreSQL Version:

14 and 15

DuckDB Version:

1.1.0

DuckDB Client:

CLI

Full Name:

Arash Nikoo

Affiliation:

Akamai

Have you tried this on the latest main branch?

  • I agree

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • I agree
@benjamingr
Copy link

(I see a similar issue in #260 but that's related to postgres and this is mysql, my relevant code (on the latest version) works with postgres)

@benjamingr
Copy link

(for what it's worth "export database" works only "copy from database" works - I'm not blocked on this or anything I'm just trying to be a good OS citizen and report bugs as I run into them)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants