pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix potential catalog corruption with temporary identity columns
Date: Mon, 29 Apr 2019 06:55:45 +0000
Message-ID: <E1hL0CX-0002TB-0i@gemulon.postgresql.org> (raw)

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>

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(+)



view thread (3+ messages)  latest in thread

Message-ID: <E1hL0CX-0002TB-0i@gemulon.postgresql.org>
Permalink:  ../E1hL0CX-0002TB-0i@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hL0CX-0002TB-0i@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org
  Subject: Re: pgsql: Fix potential catalog corruption with temporary identity columns
  In-Reply-To: <E1hL0CX-0002TB-0i@gemulon.postgresql.org>
  References: <E1hL0CX-0002TB-0i@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox