From: | Randall Smith <randall(at)tnr(dot)cc> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: cross-table unique constraint |
Date: | 2004-01-12 18:56:17 |
Message-ID: | l5CMb.11$n8.9@be1.texas.rr.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
So how might I go about doing this.
3 tables: a, b, and c
When these 3 tables are joined, there is a combination of 3 fields, one
field from each table, that should be unique.
Should there be a trigger that checks this condition on inserts/updates
on each of these tables?
Randall
Bruno Wolff III wrote:
> On Tue, Jan 06, 2004 at 07:10:28 +0000,
> Randall Smith <randall(at)tnr(dot)cc> wrote:
>
>>Is it possible to create a unique constraint on multiple fields in
>>related tables?
>
>
> Not with the normal UNIQUE constraint. That will do multiple columns in
> one table, but won't span tables.
>
> You can probably do what you want using triggers.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
From | Date | Subject | |
---|---|---|---|
Next Message | Cláudia Morgado | 2004-01-12 19:12:25 | Pass data of database Oracle to PostgreSQL |
Previous Message | Dave Smith | 2004-01-12 18:48:53 | Vacuum Error |