diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2019-04-29 08:44:51 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2019-04-29 08:49:14 +0200 |
commit | 474982fc398dc848da2d08a911e2900b9575217f (patch) | |
tree | 9fa21059a446d1247d7944509b3300f08cd4a026 | |
parent | 1bf52d68800e56eb24d3ae34ad2bb6d958d08ee7 (diff) | |
download | postgresql-474982fc398dc848da2d08a911e2900b9575217f.tar.gz postgresql-474982fc398dc848da2d08a911e2900b9575217f.zip |
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>
-rw-r--r-- | src/backend/tcop/utility.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 85f97c14333..e2434774be9 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -927,6 +927,13 @@ standard_ProcessUtility(PlannedStmt *pstmt, } free_parsestate(pstate); + + /* + * Make effects of commands visible, for instance so that + * PreCommit_on_commit_actions() can see them (see for example bug + * #15631). + */ + CommandCounterIncrement(); } /* |