Re: doubts about a constraint's definition

Started by Peter Gibbsabout 23 years ago2 messagesgeneral
Jump to latest
#1Peter Gibbs
peter@emkel.co.za

enediel wrote:

I need to create a column, where the information is conserved in the same
way that it was written by the user, but the data of this column is unique
if it's only taken to capital

declaring a constraint
... unique(column name) is not enough to me 'cause

'ab'
'AB'
'aB'
....
will be accepted

Create a unique functional index e.g.
create unique index index_name on table_name (upper(fieldname));
--
Peter Gibbs
EmKel Systems

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Gibbs (#1)

"enediel" <enediel@com.ith.tur.cu> writes:

I need to create a column, where the information is conserved in the same
way that it was written by the user, but the data of this column is unique
if it's only taken to capital

CREATE UNIQUE INDEX foo ON tab (UPPER(column));

regards, tom lane