Re: BUG #19389: pg_dump output differs after setting schema comment to NULL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: myers(at)maski(dot)org
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19389: pg_dump output differs after setting schema comment to NULL
Date: 2026-01-25 18:46:02
Message-ID: 3700752.1769366762@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Srinath Reddy Sadipiralla 2026-01-26 11:45:03 Re: Re: Re: BUG #19351: in pg18.1,when not null exists in the table , and add constraint problem.
Previous Message PG Bug reporting form 2026-01-25 16:28:45 BUG #19389: pg_dump output differs after setting schema comment to NULL