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