From: | Adrien Nayrat <adrien(dot)nayrat(at)anayrat(dot)info> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | pg_dump fail to not dump public schema orders |
Date: | 2020-05-29 13:13:42 |
Message-ID: | c4222fb6-823b-0eb8-640f-2e7d5b86439a@anayrat.info |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
I noticed pg_dump failed to not dump creation or comment commands for public
schema when we explicitly ask it to dump public schema.
Shorter example: pg_dump -n public dump will give:
--
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--
CREATE SCHEMA public;
ALTER SCHEMA public OWNER TO postgres;
--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON SCHEMA public IS 'standard public schema';
Obviously, it trigger errors when we try to restore it as public schema already
exists.
Git bisect blame this commit (since pg11):
commit 5955d934194c3888f30318209ade71b53d29777f (refs/bisect/bad)
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Date: Thu Jan 25 13:54:42 2018 -0500
Improve pg_dump's handling of "special" built-in objects.
I first tried to add an only_dump_public_schema test. I am not used to how
pg_dump tests works but I do not think it is the best approach due to how many
test I had to disable for only_dump_public_schema.
Then I tried to change selectDumpableNamespace in order to apply the same
treatment to public schema when we explicitly ask pg_dump to dump public schema.
Unfortunately this broke other tests, all related to how we handle COLLATION.
For example:
# Failed test 'only_dump_test_schema: should not dump ALTER COLLATION test0
OWNER TO'
# Failed test 'only_dump_test_schema: should not dump COMMENT ON COLLATION test0'
# Failed test 'only_dump_test_schema: should not dump CREATE COLLATION test0
FROM "C"'
# Failed test 'only_dump_test_schema: should not dump REVOKE CREATE ON SCHEMA
public FROM public'
Regards,
Attachment | Content-Type | Size |
---|---|---|
pg_dump_tests.patch | text/x-patch | 41.8 KB |
pg_dump.patch | text/x-patch | 1.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2020-05-29 13:18:27 | Re: password_encryption default |
Previous Message | Jonathan S. Katz | 2020-05-29 13:13:26 | Re: password_encryption default |