Re: foreign keys for array/period contains relationships - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: foreign keys for array/period contains relationships
Date
Msg-id 1288053482.11412.13.camel@jdavis-ux.asterdata.local
Whole thread Raw
In response to foreign keys for array/period contains relationships  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: foreign keys for array/period contains relationships
List pgsql-hackers
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.

Regards,Jeff Davis



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: foreign keys for array/period contains relationships
Next
From: Robert Haas
Date:
Subject: Re: Range Types, discrete and/or continuous