pgsql: Fix potential catalog corruption with temporary identity columns

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix potential catalog corruption with temporary identity columns
Date: 2019-04-29 06:55:45
Message-ID: E1hL0CX-0002TB-0i@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)gmail(dot)com>
Author: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/10b2675d6e79ad76f2b74c569f4cf1a716a904c1

Modified Files
--------------
src/backend/tcop/utility.c | 7 +++++++
1 file changed, 7 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Joe Conway 2019-04-29 10:45:56 Re: pgsql: Add viewBox attribute to storage page layout SVG image
Previous Message Peter Eisentraut 2019-04-29 06:06:27 Re: pgsql: Add viewBox attribute to storage page layout SVG image