Howto have a unique restraint on UPPER (textfield)

From: Andreas <maps(dot)on(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Howto have a unique restraint on UPPER (textfield)
Date: 2010-01-31 02:26:14
Message-ID: 4B64EA46.60605@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

is there a way to define a unique restraint on UPPER (textfield)?

E.g.
mytable (
name_id serial PRIMARY KEY,
name varchar(255),
UNIQUE ( upper (name) )
)

psql throws a syntax error because of the upper() function.

I need to prohibit that 2 of strings like cow, Cow, CoW appears in
the name-column.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joshua Tolley 2010-01-31 02:56:53 Re: Howto have a unique restraint on UPPER (textfield)
Previous Message Scott Marlowe 2010-01-30 16:32:54 Re: Partitioning by letter question