summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2019-04-29 06:44:51 +0000
committerPeter Eisentraut2019-04-29 06:49:03 +0000
commitcd3e27464cca40664c54fb8cd10454f979c1db4e (patch)
treef0c5291c56b7acab189e6035c69a577142c4c404
parentc3f67ed6e434333e1bc011afc94c25d9959a86bd (diff)
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 <[email protected]> Author: Peter Eisentraut <[email protected]> Reviewed-by: Michael Paquier <[email protected]>
-rw-r--r--src/backend/tcop/utility.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index edf24c438c..92d0507949 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -931,6 +931,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();
}
/*