On 2025-Jun-26, Fujii Masao wrote:
> I noticed a small inconsistency in the output of pg_dump when handling
> comments for COMMENT commands on not-null constraints. [...]
> You can see that only comments for the not-null constraint includes
> the schema-qualified table name (hoge.t) after "ON". The others just
> show "t". It's a very minor issue, but for consistency, it would be
> better if all constraint comments used the same format.
Hmm, you're right. I think we should make the tags use qualified names
instead, but that'd be a much larger patch.
> + if (comment != NULL)
> + {
> + destroyPQExpBuffer(comment);
> + destroyPQExpBuffer(tag);
>
> The "comment != NULL" check isn't needed here, since destroyPQExpBuffer()
> already handles null safely.
Hah, true.
> Since valid not-null constraints are dumped in the pre-data section,
> the following change seems necessary in pg_dump.sgml.
>
> statistics for indexes, and constraints other than validated check
> - constraints.
> + and not-null constraints.
> Pre-data items include all other data definition items.
Ah, right, did that, thank you.
Thanks for reporting this and to Jian for the quick analysis and patch!
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Oh, great altar of passive entertainment, bestow upon me thy discordant images
at such speed as to render linear thought impossible" (Calvin a la TV)