This looks like more table design problem than
database limitation.
The one column should accommodate values from both
columns with unique index built on this column. Your
requirements tell me that these values are the same
nature and should be placed in the same column. To
distinguish between them use another column to put an
attribute.
--- Jorge Godoy <jgodoy@gmail.com> wrote:
> Jonathan Vanasco <postgres@2xlp.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@gmail.com>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>