Re: BUG #4374: pg_restore does not restore public schema comment

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Daniel Migowski <dmigowski(at)ikoffice(dot)de>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4374: pg_restore does not restore public schema comment
Date: 2008-08-26 02:45:27
Message-ID: 48B36E47.3030100@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> "Daniel Migowski" <dmigowski(at)ikoffice(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-08-26 03:27:40 Re: BUG #4374: pg_restore does not restore public schema comment
Previous Message Tom Lane 2008-08-26 02:26:51 Re: non-deterministic error related to MIN/MAX optimization