I have a simple table:
create table item ( lan text not null, disabled date );
My aim is to ensure uniqueness for the
lan column over all rows, where
I created a partial index:
create unique index lan_idx on item (lan) where disabled is not null;
Now I tried to add the index to the table, but I am struggling with the syntax. (I took the code from this tutorial)
alter table item add constraint lan_idx using index lan_idx;
This throws an syntax error before "using".
I also tried the following:
alter table item add constraint lan_idx unique using index lan_idx;
But this throws the error, that a unique constraint can not be created with a partial index.
Can anybody tell me what I did wrong?