Re: foreign keys for array/period contains relationships

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: foreign keys for array/period contains relationships
Date: 2010-10-26 17:25:24
Message-ID: 1288113924.22800.4.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On mån, 2010-10-25 at 17:38 -0700, Jeff Davis wrote:
> > 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?

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. But I don't see what to do
about cascading an update when you, say, update PK 1 => 6.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2010-10-26 17:26:26 Re: Range Types, discrete and/or continuous
Previous Message Peter Eisentraut 2010-10-26 17:22:17 Re: foreign keys for array/period contains relationships