diff options
author | Tom Lane | 2025-04-02 15:13:01 +0000 |
---|---|---|
committer | Tom Lane | 2025-04-02 15:13:01 +0000 |
commit | bd178960c69bae972c274af8102da9018df8196a (patch) | |
tree | 8f568d91067e1dc214ab2b6c5c0a0d79b59d2a06 /src/backend/commands | |
parent | b05751220b0cab7bdf9b729f4fcf6f2adb2d1b46 (diff) |
Need to do CommandCounterIncrement after StoreAttrMissingVal.
Without this, an additional change to the same pg_attribute row
within the same command will fail. This is possible at least with
ALTER TABLE ADD COLUMN on a multiple-inheritance-pathway structure.
(Another potential hazard is that immediately-following operations
might not see the missingval.)
Introduced by 95f650674, which split the former coding that
used a single pg_attribute update to change both atthasdef and
atthasmissing/attmissingval into two updates, but missed that
this should entail two CommandCounterIncrements as well. Like
that fix, back-patch through v13.
Reported-by: Alexander Lakhin <[email protected]>
Author: Tender Wang <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 13
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/tablecmds.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index f47b82dbcf3..11fcb51a165 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -7533,6 +7533,8 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel, if (!missingIsNull) { StoreAttrMissingVal(rel, attribute->attnum, missingval); + /* Make the additional catalog change visible */ + CommandCounterIncrement(); has_missing = true; } FreeExecutorState(estate); |