On Tue, Jul 22, 2003 at 09:29:44AM -0600, VanL wrote:
...
> Put another way, how can I set a (domain_name, mid) UNIQUE constraint?
eg:
tree=# create table a ( a1 integer not null, a2 integer not null);
CREATE TABLE
tree=# create unique index a_idx on a(a1,a2);
CREATE INDEX
tree=# \d a
Table "public.a"
Column | Type | Modifiers
--------+---------+-----------
a1 | integer | not null
a2 | integer | not null
Indexes: a_idx unique btree (a1, a2)
tree=# insert into a values (1,2);
INSERT 43341961 1
tree=# insert into a values (1,3);
INSERT 43341962 1
tree=# insert into a values (1,2);
ERROR: Cannot insert a duplicate key into unique index a_idx
Cheers,
Patrick