Skip to content

Commit 474982f

Browse files
committed
Fix potential catalog corruption with temporary identity columns
If a temporary table with an identity column and ON COMMIT DROP is created in a single-statement transaction (not useful, but allowed), it would leave the catalog corrupted. We need to add a CommandCounterIncrement() so that PreCommit_on_commit_actions() sees the created dependency between table and sequence and can clean it up. The analogous and more useful case of doing this in a transaction block already runs some CommandCounterIncrement() before it gets to the on-commit cleanup, so it wasn't a problem in practical use. Several locations for placing the new CommandCounterIncrement() call were discussed. This patch places it at the end of standard_ProcessUtility(). That would also help if other commands were to create catalog entries that some on-commit action would like to see. Bug: #15631 Reported-by: Serge Latyntsev <dnsl48@gmail.com> Author: Peter Eisentraut <peter.eisentraut@2ndquadrant.com> Reviewed-by: Michael Paquier <michael@paquier.xyz>
1 parent 1bf52d6 commit 474982f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/backend/tcop/utility.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,13 @@ standard_ProcessUtility(PlannedStmt *pstmt,
927927
}
928928

929929
free_parsestate(pstate);
930+
931+
/*
932+
* Make effects of commands visible, for instance so that
933+
* PreCommit_on_commit_actions() can see them (see for example bug
934+
* #15631).
935+
*/
936+
CommandCounterIncrement();
930937
}
931938

932939
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy