From: Daniel CAUNE <d.caune@free.fr>
To: Michael Glaesemann <grzm@seespotcode.net>
To: Jorge Godoy <jgodoy@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Constraint UNIQUE on a column not case sensitive
Date: Sat, 01 Jul 2006 11:48:12 -0400
Message-ID: <0J1Q006T7EKBA1C0@VL-MH-MR002.ip.videotron.ca> (raw)
In-Reply-To: <07BE168B-0F4D-417A-8EB4-E1D55F753E19@seespotcode.net>
> -----Message d'origine-----
> De : Michael Glaesemann [mailto:grzm@seespotcode.net]
> 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, 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 Glaesemann
> grzm seespotcode net
>
>
Yes, indeed! I'm stupid! I was searching a constraint form while the creation of an UNIQUE index makes the job too!
The following form is not valid:
ALTER TABLE MyTable
ADD CONSTRAINT UNQ_MyTable_MyColumn
UNIQUE (lower(MyColumn));
But your form makes the expected job:
CREATE UNIQUE INDEX IDX_MyTable_MyColumn
ON MyTable (lower(MyColumn));
Thanks,
--
Daniel CAUNE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: d.caune@free.fr, grzm@seespotcode.net, jgodoy@gmail.com
Subject: Re: Constraint UNIQUE on a column not case sensitive
In-Reply-To: <0J1Q006T7EKBA1C0@VL-MH-MR002.ip.videotron.ca>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox