If Opt is set on a Key, the generated index should include a where clause i.e.
test file
mykey key(id,other),opt
record record
id long
other string(20)
. .
Should yield an index statement thus:
CREATE UNIQUE INDEX <key> ON test (id,other) WHERE id>0 AND other>'';
This will work for postgres - but note that other databases do not necessarily support indexes with predicates.