Re: [GENERAL] unique constraint on 2 columns

2007-04-26 Thread Scott Marlowe
On Fri, 2007-04-20 at 15:52, Jonathan Vanasco wrote: > 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

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jeff Davis
On Fri, 2007-04-20 at 18:32 -0400, Jonathan Vanasco wrote: > On Apr 20, 2007, at 6:13 PM, Jeff Davis wrote: > > > This is more correct structure, and yes, it would involve a join. > > I know thats the 'more correct' way -- but I can't do the join , > which is why I posted about a 2 column uniqu

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jonathan Vanasco
On Apr 20, 2007, at 6:13 PM, Jeff Davis wrote: This is more correct structure, and yes, it would involve a join. I know thats the 'more correct' way -- but I can't do the join , which is why I posted about a 2 column unique index. I tested with a join before posting - i have an already larg

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jeff Davis
On Fri, 2007-04-20 at 17:56 -0400, Jonathan Vanasco wrote: > On Apr 20, 2007, at 5:43 PM, Vladimir Zelinski wrote: > > > 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

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Tom Lane
Jonathan Vanasco <[EMAIL PROTECTED]> writes: > 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

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jonathan Vanasco
On Apr 20, 2007, at 5:43 PM, Vladimir Zelinski wrote: 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

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Vladimir Zelinski
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

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jorge Godoy
Jonathan Vanasco <[EMAIL PROTECTED]> 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

[GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jonathan Vanasco
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 appear