Re: foreign keys for array/period contains relationships

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: foreign keys for array/period contains relationships
Date: 2010-10-25 20:10:21
Message-ID: AANLkTimm9BSP-4Qb3HYtGVm8npM311YVd_Rg21dHumWf@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2010/10/25 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Mon, Oct 25, 2010 at 3:11 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> 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.
>>
>> Example #1: Foreign key side is an array, every member must match some
>> PK.
>>
>> CREATE TABLE pk (a int PRIMARKY KEY, ...);
>>
>> CREATE TABLE fk (x int[] REFERENCES pk (a), ...);

What about optimalizations and planning? This is classic sample how
don't use a arrays?

Regards

Pavel

>
> I've wished for this before when doing app dev with PG.  I think it
> would be pretty neat.  The other cases seem potentially useful, too,
> but especially this one.
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2010-10-25 20:10:48 Re: ask for review of MERGE
Previous Message Tom Lane 2010-10-25 20:09:20 Re: Floating-point timestamps versus Range Types