Re: Case insensitive unique constraint - Mailing list pgsql-novice

From Tom Lane
Subject Re: Case insensitive unique constraint
Date
Msg-id 27599.1397080813@sss.pgh.pa.us
Whole thread Raw
In response to Case insensitive unique constraint  (Michael Rowan <michael.rowan3@gmail.com>)
List pgsql-novice
Michael Rowan <michael.rowan3@gmail.com> writes:
> I would like to do this:
> ALTER TABLE a ADD CONSTRAINT a_unique UNIQUE lower(name)

You can't get to that through CONSTRAINT syntax, but you can just
create a unique index directly:

CREATE UNIQUE INDEX a_unique ON a (lower(name))

            regards, tom lane


pgsql-novice by date:

Previous
From: Michael Rowan
Date:
Subject: Case insensitive unique constraint
Next
From: Darko J
Date:
Subject: Variables inside PostgreSQL/PostGIS query in PHP file