How to create a case-insensitive unique constraint?

From: "Kynn Jones" <kynnjo(at)gmail(dot)com>
To: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: How to create a case-insensitive unique constraint?
Date: 2008-09-02 20:46:21
Message-ID: c2350ba40809021346l1ea74657jec9cb5ebd3496c49@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

If I try something like

ALTER TABLE foo
ADD CONSTRAINT foo_unique_xy
UNIQUE ( UPPER( x ), UPPER( y ) );

...I get a syntax error

ERROR: syntax error at or near "("
LINE 3: UNIQUE ( UPPER( x ), UPPER( y ) );

Is there a way to do this?

TIA!

Kynn

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Finneid 2008-09-02 20:55:26 Re: plpgsql returning resultset
Previous Message Scott Marlowe 2008-09-02 20:40:55 Re: Foreign Key normalization question