Re: Constraint UNIQUE on a column not case sensitive

From: Jorge Godoy <jgodoy(at)gmail(dot)com>
To: Daniel CAUNE <d(dot)caune(at)free(dot)fr>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Constraint UNIQUE on a column not case sensitive
Date: 2006-07-01 14:04:13
Message-ID: 87irmha0bm.fsf@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Daniel CAUNE <d(dot)caune(at)free(dot)fr> writes:

> Hi,
>
> I would like to find an efficient solution for adding/implementing a
> constraint UNIQUE on a VARCHAR column not case sensitive:
>
> ALTER TABLE MyTable
> ADD CONSTRAINT UNQ_MyTable_MyColumn
> UNIQUE (lower(MyColumn)); -- invalid syntax
>
> The idea is to have an index on that column, in a not case sensitive form,
> i.e. lower(MyColumn).

What's the problem with CREATE INDEX then?

CREATE INDEX idx_something ON mytable (lower(mycolumn));

--
Jorge Godoy <jgodoy(at)gmail(dot)com>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Daniel CAUNE 2006-07-01 15:48:12 Re: Constraint UNIQUE on a column not case sensitive
Previous Message Michael Glaesemann 2006-07-01 14:01:08 Re: Constraint UNIQUE on a column not case sensitive