pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jorge Godoy <jgodoy@gmail.com>
To: Daniel CAUNE <d.caune@free.fr>
Cc: pgsql-sql@postgresql.org
Subject: Re: Constraint UNIQUE on a column not case sensitive
Date: Sat, 01 Jul 2006 11:04:13 -0300
Message-ID: <87irmha0bm.fsf@gmail.com> (raw)
In-Reply-To: <0J1Q008ME8ZX7M90@VL-MO-MR003.ip.videotron.ca>
References: <0J1Q008ME8ZX7M90@VL-MO-MR003.ip.videotron.ca>

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>



view thread (4+ messages)  latest in thread

Message-ID: <87irmha0bm.fsf@gmail.com>
Permalink:  ../87irmha0bm.fsf@gmail.com/
Also on:    postgresql.org/message-id/87irmha0bm.fsf@gmail.com

 · 

reply

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: jgodoy@gmail.com, d.caune@free.fr
  Subject: Re: Constraint UNIQUE on a column not case sensitive
  In-Reply-To: <87irmha0bm.fsf@gmail.com>

* 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