Re: Howto have a unique restraint on UPPER (textfield)

Поиск
Список
Период
Сортировка
От Yeb Havinga
Тема Re: Howto have a unique restraint on UPPER (textfield)
Дата
Msg-id 4B6C8626.6080300@gmail.com
обсуждение исходный текст
Ответ на Howto have a unique restraint on UPPER (textfield)  (Andreas <maps.on@gmx.net>)
Список pgsql-sql
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




В списке pgsql-sql по дате отправления:

Предыдущее
От: John Lister
Дата:
Сообщение: Partitioning improvements query
Следующее
От: Louis-David Mitterrand
Дата:
Сообщение: 'image' table with relationships to different objects