Re: Case insensitive unique constraint

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Rowan <michael(dot)rowan3(at)gmail(dot)com>
Cc: pgsql-novice novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Case insensitive unique constraint
Date: 2014-04-09 22:00:13
Message-ID: 27599.1397080813@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Michael Rowan <michael(dot)rowan3(at)gmail(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Darko J 2014-04-10 14:30:47 Variables inside PostgreSQL/PostGIS query in PHP file
Previous Message Michael Rowan 2014-04-09 21:51:22 Case insensitive unique constraint