Re: foreign keys as arrays

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Alan Young <alany(at)qwest(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: foreign keys as arrays
Date: 2000-12-20 18:48:32
Message-ID: Pine.BSF.4.21.0012201041240.82408-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 20 Dec 2000, Alan Young wrote:

> Is there a way I can do something like the following?

Not really this way. We've talked about possibly at some
point allowing this as an extension to the spec on foreign
keys, but there are some behavioral things that we haven't
really figured out (what if the key isn't a single value
and you want a two dimensional array with key sets in an
array, etc...)

> create table t1 (
> t1id serial,
> );
>
> create table t2 (
> t1id int[] references t1 (t1id)
> );
>
> I know this doesn't work because I get an error message when trying to
> insert into t2.
>
> I'd like to be able allow multiple references if possible. Has anyone found
> a way to make this work?
>
> Also, how do I update an array field?
>
> For example, t2.t1id = '{1,2,3}' and I want to add 4 to make it t2.t1id =
> '{1,2,3,4}'.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc SCHAEFER 2000-12-20 19:04:50 Re: Re: [ADMIN] Help me for "DBI->connect failed: Sorry, too many clients already."
Previous Message Thomas Lockhart 2000-12-20 18:18:01 Re: Re: Generating HISTORY file