Tom Lane wrote:
> "Daniel Migowski" <dmigowski@ikoffice.de> writes:
>> Currently a schema dump (custom format, containing the public schema
>> comment) can be restored, but the public schema version is not restored.
>
>> I assume you check if a schema already exists and the skip the schema part.
>
> That assumption is false, so it's not entirely clear to me exactly what
> you are complaining about. Please provide a specific test case --- what
> did you do, what happened, what would you like to happen instead?
The issue actually appears to be that the comment on default schema like
`public' isn't dumped in the first place.
Setup:
CREATE DATABASE re;
\c re
COMMENT ON SCHEMA public IS 'public comment';
CREATE SCHEMA testschema;
COMMENT ON SCHEMA testschema IS 'testschema comment';
\q
\dn+ shows the comments as set on schema `public' and `testschema'.
The output of:
pg_dump re
includes the statement:
COMMENT ON SCHEMA testschema IS 'testschema comment';
but lacks any COMMENT statement for the `public' schema.
So: the user's report is incorrect in blaming pg_restore, but correct in
that comments on the public schema (and presumably other default schema)
aren't preserved by pg_dump | pg_restore. The real reason appears to be
that they're not dumped in the first place.
I haven't checked to see if a custom dump behaves differently.
--
Craig Ringer