From: | <wumpus(at)z1p(dot)biz> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | feature request: create table with unique constraint |
Date: | 2009-12-17 20:51:07 |
Message-ID: | 74fb2406fc0c223321fbd71021fb32dc@secure-mail.biz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
begin ;
create table a (
id serial primary key
, info text not null -- not interested here
) ;
create table b (
id serial primary key
, a_id int not null references a
, info text not null -- not interested here
, actual bool not null
) ;
create unique index b_actual on b
( a_id , ( case when actual then 0 else id end ) )
;
create table c (
id serial primary key
, a_id int not null references a
, info text not null -- not interested here
, actual bool not null
, unique ( a_id , ( case when actual then 0 else id end ) )
) ;
Why can i not define the unique constraint in the
create table? I know this is described in the manual but
why this is.
thanks
Andreas
btw Why must i give the index a name. The name should
be created automatically if none is specified as i
define a unique constraint in the create table.
From | Date | Subject | |
---|---|---|---|
Next Message | Antonio Goméz Soto | 2009-12-17 21:26:53 | alter table performance |
Previous Message | Bruce Momjian | 2009-12-17 19:54:45 | Re: How to remove non-UTF values from a table? |