From: | ROCHER Julien <julien(dot)rocher(at)emeria(dot)eu> |
---|---|
To: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | TR: Issue: --exclude-schema flag not working with pgrestore |
Date: | 2023-01-11 09:07:08 |
Message-ID: | PR0P264MB049277C2C09E857806770496EDFC9@PR0P264MB0492.FRAP264.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi,
I don’t expect the --exclude-schema flag (-N) to restore chosen schema with pgrestore<https://docs.postgresql.fr/11/app-pgrestore.html> tool, but it actually tries to create the schema then its table.
I deliberately keep the same db name in the below example because this is actually what I’m trying to do (restore a dump from a similar db but excluding some already existing schemas on it), but I guess you don’t need to deal with this detail.
Did I misunderstand this command ?
➜ ~ psql -U julien -W -p 5432 -d postgres -c "create schema schemaA; create schema schemaB;"
Password:
CREATE SCHEMA
CREATE SCHEMA
➜ ~ psql -U julien -W -p 5432 -d postgres -c "create table schemaA.tableA(f int); create table schemaB.tableB(f int);"
Password:
CREATE TABLE
CREATE TABLE
➜ ~ pg_dump -p 5432 -W -d postgres --format=c > dump.sql
Password:
➜ ~ pg_restore -p 5432 -W -d postgres --verbose -N schemaB dump.sql
pg_restore: connecting to database for restore
Password:
pg_restore: creating SCHEMA "schemaa"
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 6; 2615 16389 SCHEMA schemaa julien
pg_restore: error: could not execute query: ERROR: schema "schemaa" already exists
Command was: CREATE SCHEMA schemaa;
pg_restore: creating SCHEMA "schemab"
pg_restore: from TOC entry 7; 2615 16390 SCHEMA schemab julien
pg_restore: error: could not execute query: ERROR: schema "schemab" already exists
Command was: CREATE SCHEMA schemab;
pg_restore: creating TABLE "schemaa.tablea"
pg_restore: from TOC entry 216; 1259 16391 TABLE tablea julien
pg_restore: error: could not execute query: ERROR: relation "tablea" already exists
Command was: CREATE TABLE schemaa.tablea (
f integer
);
pg_restore: creating TABLE "schemab.tableb"
pg_restore: from TOC entry 217; 1259 16394 TABLE tableb julien
pg_restore: error: could not execute query: ERROR: relation "tableb" already exists
Command was: CREATE TABLE schemab.tableb (
f integer
);
pg_restore: processing data for table "schemaa.tablea"
pg_restore: processing data for table "schemab.tableb"
pg_restore: warning: errors ignored on restore: 4
Julien ROCHER
Développeur Team Data - Migration
Emeria Technologies
76-78 Avenue des Champs Elysées – 75008 Paris
06 17 17 60 64
julien(dot)rocher(at)emeria(dot)eu<mailto:julien(dot)rocher(at)emeria(dot)eu>
From | Date | Subject | |
---|---|---|---|
Next Message | Julien Rouhaud | 2023-01-11 09:40:26 | Re: TR: Issue: --exclude-schema flag not working with pgrestore |
Previous Message | Frank Reppin | 2023-01-11 08:32:51 | Re: BUG #17733: ERROR: could not load library "/Users/frank/postgres/postgresql-13.9/lib/postgresql/llvmjit.so": dl |