Re: Constraint UNIQUE on a column not case sensitive - Mailing list pgsql-sql

From Jorge Godoy
Subject Re: Constraint UNIQUE on a column not case sensitive
Date
Msg-id 87irmha0bm.fsf@gmail.com
Whole thread Raw
In response to Constraint UNIQUE on a column not case sensitive  (Daniel CAUNE <d.caune@free.fr>)
List pgsql-sql
Daniel CAUNE <d.caune@free.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@gmail.com>


pgsql-sql by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Constraint UNIQUE on a column not case sensitive
Next
From: Daniel CAUNE
Date:
Subject: Re: Constraint UNIQUE on a column not case sensitive