Re: BUG #4374: pg_restore does not restore public schema comment - Mailing list pgsql-bugs

From Craig Ringer
Subject Re: BUG #4374: pg_restore does not restore public schema comment
Date
Msg-id 48B36E47.3030100@postnewspapers.com.au
Whole thread Raw
In response to Re: BUG #4374: pg_restore does not restore public schema comment  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #4374: pg_restore does not restore public schema comment
Re: BUG #4374: pg_restore does not restore public schema comment
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: non-deterministic error related to MIN/MAX optimization
Next
From: Tom Lane
Date:
Subject: Re: BUG #4374: pg_restore does not restore public schema comment