From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Apply table and domain CHECK constraints in name order.
Date: Mon, 23 Mar 2015 20:59:48 +0000
Message-ID: <E1Ya9Rs-0000Hk-G1@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Apply table and domain CHECK constraints in name order.
Previously, CHECK constraints of the same scope were checked in whatever
order they happened to be read from pg_constraint. (Usually, but not
reliably, this would be creation order for domain constraints and reverse
creation order for table constraints, because of differing implementation
details.) Nondeterministic results of this sort are problematic at least
for testing purposes, and in discussion it was agreed to be a violation of
the principle of least astonishment. Therefore, borrow the principle
already established for triggers, and apply such checks in name order
(using strcmp() sort rules). This lets users control the check order
if they have a mind to.
Domain CHECK constraints still follow the rule of checking lower nested
domains' constraints first; the name sort only applies to multiple
constraints attached to the same domain.
In passing, I failed to resist the temptation to wordsmith a bit in
create_domain.sgml.
Apply to HEAD only, since this could result in a behavioral change in
existing applications, and the potential regression test failures have
not actually been observed in our buildfarm.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/e5f455f59fed0632371cddacddd79895b148dc07
Modified Files
--------------
doc/src/sgml/ref/create_domain.sgml | 47 ++++++++++++++++++----
doc/src/sgml/ref/create_table.sgml | 8 ++++
src/backend/utils/cache/relcache.c | 17 ++++++++
src/backend/utils/cache/typcache.c | 59 +++++++++++++++++++++++++---
src/test/regress/input/constraints.source | 2 +-
src/test/regress/output/constraints.source | 18 ++++-----
6 files changed, 128 insertions(+), 23 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
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: Apply table and domain CHECK constraints in name order.
In-Reply-To: <E1Ya9Rs-0000Hk-G1@gemulon.postgresql.org>
References: <E1Ya9Rs-0000Hk-G1@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