I found a way to do it like this
create table parts (part_id int, description character varying(33) constraint part_id unique , primary key (part_id));
create table vendors (vendor_id int, description character varying(33) constraint vendor_id unique, primary key
(vendor_id));
CREATE TABLE parts_vendors ( part_id integer unique references parts (part_id), vendor_id integer unique references
vendors(vendor_id));
On Sun, Feb 01, 2004 at 08:11:50PM +1100, Russell Shaw wrote:
> 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...
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--
joe speigle