On Mon, 2010-10-25 at 22:11 +0300, Peter Eisentraut wrote:
> Currently, foreign keys only work with the = operator (the name might be
> different, but it needs to behave like equality). I'm thinking there
> are other scenarios that could be useful, for example with arrays and
> range types.
I agree completely. I had not previously considered that arrays could
benefit from this idea as well as range types. Mentally, I had already
been calling them "foreign range keys" ;)
> Implementing the foreign key side of this merely requires the system to
> have some knowledge of the required "contains" operator, which it does
> in the array case, and something can surely be arranged for the range
> case. The problem is you can't do cascading updates or deletes, but you
> could do on update/delete restrict, which is still useful.
Why can't you do cascading updates/deletes?
> Is this sort of thing feasible? Has anyone done more research into the
> necessary details?
Yes, I think so. #3 and #4 are very feasible. #1 and #2 are, as well,
unless I'm missing something.
In response to
pgsql-hackers by date
|Next:||From: Robert Haas||Date: 2010-10-26 00:38:20|
|Subject: Re: Range Types, discrete and/or continuous|
|Previous:||From: Jeff Davis||Date: 2010-10-26 00:24:47|
|Subject: Re: foreign keys for array/period contains relationships|