pgsql: Fix multiple assignments to a column of a domain type.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix multiple assignments to a column of a domain type.
Date: 2017-07-11 20:49:47
Message-ID: E1dV26N-0000Hs-5T@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix multiple assignments to a column of a domain type.

We allow INSERT and UPDATE commands to assign to the same column more than
once, as long as the assignments are to subfields or elements rather than
the whole column. However, this failed when the target column was a domain
over array rather than plain array. Fix by teaching process_matched_tle()
to look through CoerceToDomain nodes, and add relevant test cases.

Also add a group of test cases exercising domains over array of composite.
It's doubtless accidental that CREATE DOMAIN allows this case while not
allowing straight domain over composite; but it does, so we'd better make
sure we don't break it. (I could not find any documentation mentioning
either side of that, so no doc changes.)

It's been like this for a long time, so back-patch to all supported
branches.

Discussion: https://postgr.es/m/4206.1499798337@sss.pgh.pa.us

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a8358559e78893725cab888ba0077ca216d619d6

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c | 31 ++++++++++
src/test/regress/expected/domain.out | 110 +++++++++++++++++++++++++++++++++--
src/test/regress/sql/domain.sql | 48 +++++++++++++++
3 files changed, 185 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message pgsql 2017-07-11 22:57:48 pgsql: Tag refs/tags/REL_10_BETA2 was created
Previous Message Masahiko Sawada 2017-07-11 00:21:13 Re: pgsql: Allow multiple hostaddrs to go with multiple hostnames.