Re: Constrain duplicate patterns

From: Russell Shaw <rjshaw(at)iprimus(dot)com(dot)au>
To:
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Constrain duplicate patterns
Date: 2004-02-01 09:11:50
Message-ID: 401CC2D6.5000009@iprimus.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Russell Shaw wrote:
> Hi,
>
> Is there a way to make postgresql report an error if when
> inserting data, a multiple-column combination is duplicated?
>
> CREATE TABLE parts_vendors (
> part_id integer references parts (part_id),
> vendor_id integer references vendors (vendor_id),
> ...
> )
>
> part_id vendor_id
> ------------------
> 1 3
> 2 5 <--+
> 7 9 |
> 2 5 <--+-- duplicate pattern
> ...
>

Oops, i can just do a select on the various columns
to detect this...

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Glaesemann 2004-02-01 09:21:54 Re: Constrain duplicate patterns
Previous Message Russell Shaw 2004-02-01 09:06:47 Constrain duplicate patterns