]> granicus.if.org Git - postgresql/commit
Fix multiple assignments to a column of a domain type.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 11 Jul 2017 20:48:59 +0000 (16:48 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 11 Jul 2017 20:48:59 +0000 (16:48 -0400)
commitb1cb32fb62c9951c9ba35cb774fb8beec9090cb7
tree8ba609733c79f9e32d5d12458c16255a23641f1a
parent42171e2cd23c8307bbe0ec64e901f58e297db1c3
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
src/backend/rewrite/rewriteHandler.c
src/test/regress/expected/domain.out
src/test/regress/sql/domain.sql