Re: foreign keys for array/period contains relationships

Jeff Davis <pgsql@j-davis.com>

From: Jeff Davis <pgsql@j-davis.com>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-hackers@postgresql.org
Date: 2010-10-26T18:53:27Z
Lists: pgsql-hackers
On Tue, 2010-10-26 at 20:25 +0300, Peter Eisentraut wrote:
> Let's say you have
> 
> PK
> 
> 1
> 2
> 3
> 4
> 5
> 
> FK
> 
> [1,2,3]
> [3,4,5]
> [4,4,4]
> 
> When you delete PK = 3, what do you  expect to happen?  OK, you might
> decide to delete the first two rows from the FK table.  This might or
> might not make sense in a particular case, but on delete cascade is an
> option the user has to choose explicitly.

That's what I would expect.

> But I don't see what to do
> about cascading an update when you, say, update PK 1 => 6.

Intuitively, I would expect all 1's to be replaced by 6's in all arrays.
But I can now see why you would be hesitant to try to support that.

Regards,
	Jeff Davis