Re: pg_dump misses comments on NOT NULL constraints

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg_dump misses comments on NOT NULL constraints
Date: 2025-06-25 18:45:51
Message-ID: 202506251845.cfkgafjcctdu@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Jun-25, Álvaro Herrera wrote:

> Ah, thanks for the test case. Yeah, I removed one 'if' condition too
> many from Jian's patch. We just need to test the constraint name for
> nullness and then things seem to work:

One more thing was missing, which I noticed as I added the tests.
Apparently the COMMENT objects can end up in any section of the dump,
but for comments on valid constraints, this is not what we want -- they
should go into the PRE_DATA section only. When running the tests with
the code still putting them in SECTION_NONE, apparently pg_dump would
randomly put them either here or there, so the tests would fail
intermittently. Or at least that's what I think happened. Once I made
them be in SECTION_PRE_DATA, that problem disappeared.

Anyway, here's what I intend to push tomorrow, unless further problems
are found.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"No nos atrevemos a muchas cosas porque son difíciles,
pero son difíciles porque no nos atrevemos a hacerlas" (Séneca)

Attachment Content-Type Size
v4-0001-pg_dump-include-comments-on-valid-not-null-constr.patch text/x-diff 10.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2025-06-25 19:59:23 Re: Huge commitfest app update upcoming: Tags, Draft CF, Help page, and automated commitfest creat/open/close
Previous Message Aleksander Alekseev 2025-06-25 18:28:52 Re: Huge commitfest app update upcoming: Tags, Draft CF, Help page, and automated commitfest creat/open/close