From: | Andreas Seltenreich <andreas+pg(at)gate450(dot)dyndns(dot)org> |
---|---|
To: | Ketema Harris <ketema(at)gmail(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Foreign Keys With Arrays |
Date: | 2006-02-07 08:09:40 |
Message-ID: | 87irrr8u9n.fsf@gate450.dyndns.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Andreas Seltenreich writes:
> Ketema Harris writes:
>
>> If I have a column that is of type int4[] (array of integers) is it possible
>> to require that each integer within that array is a foreign key?
>
> I'm afraid you'll have to define a custom check-constraint to do that.
>
> E.g.
>
[...]
> scratch=# create function valid_array(a int4[]) returns boolean as $$
[...]
...and of course you'll need the appropriate trigger function on the
referenced table to maintain referential integrity, but I hope the
example will get you going.
regards,
Andreas
--
From | Date | Subject | |
---|---|---|---|
Next Message | Srinivas Iyyer | 2006-02-07 17:56:30 | Please comment on pgsql speed at handling 550,000 records |
Previous Message | Andreas Seltenreich | 2006-02-07 07:58:03 | Re: Foreign Keys With Arrays |