Re: [PATCH] Support for Array ELEMENT Foreign Keys
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Marco Nenciarini <marco.nenciarini@2ndquadrant.it>, pgsql-hackers@postgresql.org
Date: 2012-10-19T19:09:26Z
Lists: pgsql-hackers
On 10/18/2012 10:26 PM, Tom Lane wrote: > Another possibility is to forget about the column constraint ELEMENT > REFERENCES syntax, and only support the table-constraint syntax with > ELEMENT inside the column list --- I've not checked, but I think that > syntax doesn't have any ambiguity problems. > > Or we could go back to using ARRAY here --- that should be safe since > ARRAY is already fully reserved. > > Or we could choose some other syntax. I'm wondering about dropping the > use of a keyword entirely, and instead using '[]' decoration. This > wouldn't work too badly in the table constraint case: > > FOREIGN KEY (foo, bar[]) REFERENCES t (x,y) > > but I'm less sure where to put the decoration for the column constraint > case. > > Thoughts? > > I'm late to this party, so I apologize in advance if this has already been considered, but do we actually need a special syntax? Can't we just infer that we have one of these when the referring column is an array and the referenced column is of the base type of the array? cheers andrew