Re: BUG #19389: pg_dump output differs after setting schema comment to NULL - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #19389: pg_dump output differs after setting schema comment to NULL
Date
Msg-id 3700752.1769366762@sss.pgh.pa.us
Whole thread Raw
In response to BUG #19389: pg_dump output differs after setting schema comment to NULL  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> After adding a comment to a schema and then setting the comment to NULL,
> `pg_dump` produces different output compared to the initial state before any
> comment operations. The expected behavior is that `COMMENT ON SCHEMA ... IS
> NULL` should return the schema to its original uncommented state.

It does, if you try this with any ordinary schema.  But the public
schema is special because (a) it's created at initdb and (b) initdb
gives it a comment.  pg_dump is aware of this and does not emit any
COMMENT ON SCHEMA command when public's comment is the built-in
default.  However, if you've removed public's comment, it has to
emit a command to replicate that state of affairs, so it does

    COMMENT ON SCHEMA public IS '';

It'd be slightly nicer perhaps if it said

    COMMENT ON SCHEMA public IS NULL;

but the end result is the same since the backend treats these two
commands equivalently.

If you actually want to revert the public schema to its initial state,
what you need to do is

COMMENT ON SCHEMA public IS 'standard public schema';

            regards, tom lane



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #19389: pg_dump output differs after setting schema comment to NULL
Next
From: Srinath Reddy Sadipiralla
Date:
Subject: Re: Re: Re: BUG #19351: in pg18.1,when not null exists in the table , and add constraint problem.