Fix propagating attnotnull in multiple inheritance
Alvaro Herrera <alvherre@alvh.no-ip.org>
Fix propagating attnotnull in multiple inheritance In one of the many strange corner cases of multiple inheritance being used, commit b0e96f311985 missed a CommandCounterIncrement() call after updating the attnotnull flag during ALTER TABLE ADD COLUMN, which caused a catalog tuple to be update attempted twice in the same command, giving rise to a "tuple already updated by self" error. Add the missing call to solve that, and a test case that reproduces the scenario. As a (perhaps surprising) secondary effect, this CCI addition triggers another behavior change: when a primary key is added to a parent partitioned table and the column in an existing partition does not have a not-null constraint, we no longer error out. This will probably be a welcome change by some users, and I think it's unlikely that anybody will miss the old behavior. Reported-by: Alexander Lakhin <exclusion@gmail.com> Discussion: http://postgr.es/m/045dec3f-9b3d-aa44-0c99-85f6992306c7@gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/tablecmds.c | modified | +4 −0 |
| src/test/regress/expected/constraints.out | modified | +9 −1 |
| src/test/regress/expected/inherit.out | modified | +8 −0 |
| src/test/regress/sql/constraints.sql | modified | +7 −0 |
| src/test/regress/sql/inherit.sql | modified | +7 −0 |
Discussion
- cataloguing NOT NULL constraints 163 messages · 2022-08-17 → 2024-05-16