Tuesday, September 16, 2008

Re: [GENERAL] Help with a foreign key with non-unique reference?

On Tue, 16 Sep 2008, Brent Wood wrote:

> I need a foreign key (or equivalent) where the referenced table cannot
> have a unique constraint.

Well, do you need a full foreign key or just the insert-time check on the
referencing table? Does the referenced table get updates or deletes that
you want to watch for, and do you want those to error or to do the
equivalent of one of the referential actions?

For the insert-time check only if you don't care about deletes or updates
to the referenced table, a trigger that checks for existance is probably
good enough.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

No comments: