Subject Make a column unique and case insensitive
Author ygboro
Hello,
please, how to make a varchar type column unique and case insensitive ?
I tried to use unique constraint:
CREATE TABLE TEST (COL1 VARCHAR(4) NOT NULL);
ALTER TABLE TEST ADD CONSTRAINT UNQ1_TEST UNIQUE (COL1)
USING INDEX UNQ1_IDX_COL1;
But such constraint is case sensitive and allows both 'abcd' and
'ABCD' to be stored.

Then I tried unique expression index instead of unique constraint:
CREATE UNIQUE INDEX TEST_IDX1_COL1 ON TEST COMPUTED BY (UPPER(COL1));
To my surprise this index acts like a constraint watching for
uppercase duplicity of incomming values. I used FB 2.0.1

Is unique expression index a valid way to enforce uniqueness and case
insensitivity for a column ? Are there better ways how to do it ?

Boro