Re: BUG #19074: pg_dump from v18 loses the NOT NULL flag in the inherited table field when dumping v17-databases
Álvaro Herrera <alvherre@kurilemu.de>
From: Álvaro Herrera <alvherre@kurilemu.de>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: David Rowley <dgrowleyml@gmail.com>, andrewbille@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2025-10-06T10:44:28Z
Lists: pgsql-bugs
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix determination of not-null constraint "locality" for inherited columns
- c945b06d5f03 17.7 landed
- 615ff828e1cb 19 (unreleased) landed
- 0fe07fa115f5 18.1 landed
-
Fix pg_dump sorting of foreign key constraints
- d20df9590aef 13.23 landed
- 7419c99a25fb 17.7 landed
- 6062c3db3093 14.20 landed
- 4cc3b4445913 15.15 landed
- 4921a5972a34 19 (unreleased) landed
- 162e70ea06eb 18.1 landed
- 06c1ee6b75dc 16.11 landed
-
Sort dump objects independent of OIDs, for the 7 holdout object types.
- 0decd5e89db9 19 (unreleased) cited
-
Add pg_constraint rows for not-null constraints
- 14e87ffa5c54 18.0 cited
On 2025-Oct-06, Dilip Kumar wrote: > While quickly checking this commit, it seems the problem is that > before this commit we had a simple logic to add an additional ALTER > TABLE to SET NULL, if the attribute has a not null constraint but the > the parent from which it is inherited doesn't have not null constraint > [1]. Whereas after this commit, it seems we removed this ALTER > command and tried to add the not null constraint while creating the > inherited table itself, which is fine. But here the logic to identify > whether the constraint is local or not for v17 is not correct [2], it > sets "notnull_islocal", only if the "attislocal" is true, which seems > to be wrong. Because the test case given in this bug the attribute is > not local but it is marked not null. Ah, right, the column is indeed not local, but the constraint is. I think this means we need to use flagInhAttrs to require the constraint to be printed ... looking. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/