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: Remove heuristic same-transaction test from check_safe_enum_use(
Date: Tue, 26 Sep 2017 17:15:05 +0000
Message-ID: <E1dwtRp-0005YC-QA@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Remove heuristic same-transaction test from check_safe_enum_use().

The blacklist mechanism added by the preceding commit directly fixes
most of the practical cases that the same-transaction test was meant
to cover.  What remains is use-cases like

	begin;
	create type e as enum('x');
	alter type e add value 'y';
	-- use 'y' somehow
	commit;

However, because the same-transaction test is heuristic, it fails on
small variants of that, such as renaming the type or changing its
owner.  Rather than try to explain the behavior to users, let's
remove it and just have a rule that the newly added value can't be
used before being committed, full stop.  Perhaps later it will be
worth the implementation effort and overhead to have a more accurate
test for type-was-created-in-this-transaction.  We'll wait for some
field experience with v10 before deciding to do that.

Back-patch to v10.

Discussion: https://postgr.es/m/20170922185904.1448.16585@wrigleys.postgresql.org

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/01c5de88ff242b379a033e46e4da6476f2213029

Modified Files
--------------
doc/src/sgml/ref/alter_type.sgml   |  3 +--
src/backend/utils/adt/enum.c       | 41 +++++++++-----------------------------
src/test/regress/expected/enum.out | 18 ++++++++---------
src/test/regress/sql/enum.sql      | 11 +++++-----
4 files changed, 24 insertions(+), 49 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: <E1dwtRp-0005YC-QA@gemulon.postgresql.org>
Permalink:  ../E1dwtRp-0005YC-QA@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1dwtRp-0005YC-QA@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: Remove heuristic same-transaction test from check_safe_enum_use(
  In-Reply-To: <E1dwtRp-0005YC-QA@gemulon.postgresql.org>
  References: <E1dwtRp-0005YC-QA@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