"Matthew T. O'Connor" <matthew@zeut.net> writes: > Now, I know I can specify a constraint name inside the alter command, > but I still expected this to work.
It does, in 8.0. regression=# create table foo (id1 int, id2 int, id3 int); CREATE TABLE regression=# ALTER TABLE foo ADD unique (id1,id2); NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "foo_id1_key" for table "foo" ALTER TABLE regression=# ALTER TABLE foo ADD unique (id1,id3); NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "foo_id1_key1" for table "foo" ALTER TABLE regression=# Of course there's no free lunch: it's significantly harder to guess what the index name will be... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match