From: | Zoltan Boszormenyi <zb(at)cybertec(dot)at> |
---|---|
To: | List pgsql-patches <pgsql-patches(at)postgresql(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Hans-Juergen Schoenig <hs(at)cybertec(dot)at> |
Subject: | Problem with pg_dump -n schemaname |
Date: | 2007-11-16 10:26:55 |
Message-ID: | 473D706F.4070401@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Hi,
we came across a problem when you want to dump only one schema.
The ASCII output when loaded with psql into an empty database
doesn't produce an identical schema to the original.
The problem comes from this statement ordering:
SET ... -- some initial DB parameters
...
SET search_path = schemaname , pg_catalog;
-- the above fails because no schema with this name exists
-- as a consequence, the original search_path (e.g. "$user",
public)
-- is not modified
DROP INDEX schemaname.index1;
...
DROP TABLE schemaname.table1;
DROP SCHEMA schemaname;
CREATE SCHEMA schemaname;
ALTER SCHEMA schemaname OWNER TO schemaowner;
CREATE TABLE table1; -- note that it was DROPped with full name
schemaname.table1
...
So, because search_path is ' "$user", public ' for e.g. postgres,
the tables are created in the public schema. Hence, I propose
the attached patch which issues "SET search_path = ..." statements
before the first CREATE TABLE stmt in their respective schema
instead of before the first DROP command.
The problem manifests only when you dump only one schema.
The same problem exists in at least 8.0.3, 8.2.5 and last 8.3cvs.
Best regards,
Zoltán Böszörményi
--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/
Attachment | Content-Type | Size |
---|---|---|
pg825-pg_dump-fix.patch | text/x-patch | 768 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Sam Mason | 2007-11-16 10:29:09 | Re: Javascript support in the backend, i.e. PL/JS |
Previous Message | Magnus Hagander | 2007-11-16 09:33:12 | Re: [COMMITTERS] pgsql: update files for beta3 |
From | Date | Subject | |
---|---|---|---|
Next Message | Kenneth Marshall | 2007-11-16 13:30:42 | Re: hashlittle(), hashbig(), hashword() and endianness |
Previous Message | Alex Vinokur | 2007-11-16 09:19:13 | Re: hashlittle(), hashbig(), hashword() and endianness |