pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Relax transactional restrictions on ALTER TYPE ... ADD VALUE.
Date: Mon, 05 Sep 2016 17:00:14 +0000
Message-ID: <E1bgxFm-0005uI-1P@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Relax transactional restrictions on ALTER TYPE ... ADD VALUE.

To prevent possibly breaking indexes on enum columns, we must keep
uncommitted enum values from getting stored in tables, unless we
can be sure that any such column is new in the current transaction.

Formerly, we enforced this by disallowing ALTER TYPE ... ADD VALUE
from being executed at all in a transaction block, unless the target
enum type had been created in the current transaction.  This patch
removes that restriction, and instead insists that an uncommitted enum
value can't be referenced unless it belongs to an enum type created
in the same transaction as the value.  Per discussion, this should be
a bit less onerous.  It does require each function that could possibly
return a new enum value to SQL operations to check this restriction,
but there aren't so many of those that this seems unmaintainable.

Andrew Dunstan and Tom Lane

Discussion: <4075.1459088427@sss.pgh.pa.us>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/15bc038f9bcd1a9af3f625caffafc7c20322202d

Modified Files
--------------
doc/src/sgml/ref/alter_type.sgml   |   6 ++-
src/backend/commands/typecmds.c    |  21 +-------
src/backend/tcop/utility.c         |   2 +-
src/backend/utils/adt/enum.c       | 104 +++++++++++++++++++++++++++++++++++++
src/backend/utils/errcodes.txt     |   1 +
src/include/commands/typecmds.h    |   2 +-
src/test/regress/expected/enum.out |  65 +++++++++++++++++++----
src/test/regress/sql/enum.sql      |  30 ++++++++---
8 files changed, 191 insertions(+), 40 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (2+ messages)  latest in thread

Message-ID: <E1bgxFm-0005uI-1P@gemulon.postgresql.org>
Permalink:  ../E1bgxFm-0005uI-1P@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1bgxFm-0005uI-1P@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Relax transactional restrictions on ALTER TYPE ... ADD VALUE.
  In-Reply-To: <E1bgxFm-0005uI-1P@gemulon.postgresql.org>
  References: <E1bgxFm-0005uI-1P@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