> -Message d'origine-
> De : Michael Glaesemann [mailto:[EMAIL PROTECTED]
> Envoyé : samedi 1 juillet 2006 10:01
> À : Daniel CAUNE
> Cc : pgsql-sql@postgresql.org
> Objet : Re: [SQL] Constraint UNIQUE on a column not case sensitive
>
>
> On Jul 1, 200
Daniel CAUNE <[EMAIL PROTECTED]> 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 synt
On Jul 1, 2006, at 22:47 , Daniel CAUNE wrote:
The idea is to have an index on that column, in a not case
sensitive form, i.e. lower(MyColumn).
I think you're really close. Try
CREATE UNIQUE INDEX ci_mycolumn_idx ON mytable(lower(mycolumn));
Does that do what you're looking for?
Michael G
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 n