Re: unique constraint on 2 columns

From: Jorge Godoy <jgodoy(at)gmail(dot)com>
To: Jonathan Vanasco <postgres(at)2xlp(dot)com>
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: unique constraint on 2 columns
Date: 2007-04-20 21:04:58
Message-ID: 87647qpxj9.fsf@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jonathan Vanasco <postgres(at)2xlp(dot)com> writes:

> I need a certain unique constraint in pg that i can't figure out.
>
> Given:
>
> create table test_a (
> id serial ,
> name_1 varchar(32) ,
> name_2 varchar(32)
> );
>
> I need name_1 and name_2 to both be unique so that:
> name_1 never appears in name_1 or name_2
> name_2 never appears in name_2 or name_1
>
>
> a standard 2 column unique index / constraint will not accomplish this.

But a trigger will...

--
Jorge Godoy <jgodoy(at)gmail(dot)com>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Frysinger 2007-04-20 21:26:26 Re: cant get pg_dump/pg_restore to behave
Previous Message Jonathan Vanasco 2007-04-20 20:52:37 unique constraint on 2 columns