Domains and arrays and composites, oh my
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@postgreSQL.org
Date: 2017-07-11T18:38:57Z
Lists: pgsql-hackers
Attachments
- fix-multiple-assignment-to-domain-over-array.patch (text/x-diff) patch
I started to look into allowing domains over composite types, which is another never-implemented case that there's no very good reason not to allow. Well, other than the argument that the SQL standard only allows domains over "predefined" (built-in) types ... but we blew past that restriction ages ago. Any thought that there might be some fundamental problem with that was soon dispelled when I noticed that we allow domains over arrays of composite types. Ahem. They even work, mostly. I wrote a few test cases and couldn't find anything that failed except for attempts to insert or update multiple subfields of the same base column; that's because process_matched_tle() fails to look through CoerceToDomain nodes. But that turns out to be a bug even for the simpler case of domains over arrays of scalars, which is certainly supported. That is, given create domain domainint4arr int4[]; create table domarrtest (testint4arr domainint4arr); this ought to work: insert into domarrtest (testint4arr[1], testint4arr[3]) values (11,22); It would work with a plain-array target column, but with the domain it fails with ERROR: multiple assignments to same column "testint4arr" Hence, the attached proposed patch, which fixes that oversight and adds some relevant test cases. (I've not yet looked to see if any documentation changes would be appropriate.) I think this is a bug fix and should be back-patched. Any objections? regards, tom lane
Commits
-
Support domains over composite types in PL/Perl.
- 60651e4cddbb 11.0 landed
-
Support domains over composite types in PL/Tcl.
- 820c0305f645 11.0 landed
-
Support domains over composite types.
- 37a795a60b4f 11.0 landed
-
Fix multiple assignments to a column of a domain type.
- b1cb32fb62c9 10.0 landed
- a8358559e788 9.4.13 landed
- 56076b88dae0 9.5.8 landed
- 55204850a9de 9.2.22 landed
- 521fede166d6 9.3.18 landed
- 123368061188 9.6.4 landed