Search Postgresql Archives

Re: unique constraint on 2 columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Vanasco <postgres@xxxxxxxx> 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@xxxxxxxxx>


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux