Skip site navigation (1) Skip section navigation (2)

Re: foreign keys for array/period contains relationships

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: foreign keys for array/period contains relationships
Date: 2010-10-25 19:43:05
Message-ID: AANLkTimcWAesj+cDh62qxXKuzrvA--+ULJa8i-kSr=Pn@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
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), ...);

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

In response to

Responses

pgsql-hackers by date

Next:From: Anders SteinleinDate: 2010-10-25 19:46:02
Subject: Bug: citext not working in non-public schema
Previous:From: Robert HaasDate: 2010-10-25 19:40:07
Subject: Re: ask for review of MERGE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group