diff options
author | Michael Paquier <michael@paquier.xyz> | 2024-01-24 14:20:13 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2024-01-24 14:20:13 +0900 |
commit | bfec14d06de8d953260348b575f6645c1fb92f7f (patch) | |
tree | 6d1248006e2274278643507bfc96ff7c567a231e /src/backend/commands/tablecmds.c | |
parent | dc9d424cf0cdac4971b89e426554d9562c4b9349 (diff) |
Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees
This command, when used to add a column on a parent table with a complex
inheritance tree, tried to update multiple times the same tuple in
pg_attribute for a child table when incrementing attinhcount, causing
failures with "tuple already updated by self" because of a missing
CommandCounterIncrement() between two updates.
This exists for a rather long time, so backpatch all the way down.
Reported-by: Alexander Lakhin
Author: Tender Wang
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18297-b04cd83a55b51e35@postgresql.org
Backpatch-through: 12
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 98fbe0588cc..ddc15c31c1f 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -6291,6 +6291,10 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel, colDef->colname, RelationGetRelationName(rel)))); table_close(attrdesc, RowExclusiveLock); + + /* Make the child column change visible */ + CommandCounterIncrement(); + return InvalidObjectAddress; } } |