Andreas wrote:
> is there a way to define a unique restraint on UPPER (textfield)?
> psql throws a syntax error because of the upper() function.
The third section of the create index command at
http://www.postgresql.org/docs/8.4/interactive/sql-createindex.html
describes a function based index with as example the function ....
upper! :-)
postgres=# create table aap (a text);
CREATE TABLE
postgres=# create unique index ai on aap (upper(a));
CREATE INDEX
postgres=# insert into aap values ('aap');
INSERT 0 1
postgres=# insert into aap values ('aaP');
ERROR: duplicate key value violates unique constraint "ai"
regards,
Yeb Havinga