How to create case insensitive unique constraint

From: "Andrus" <eetasoft(at)online(dot)ee>
To: pgsql-general(at)postgresql(dot)org
Subject: How to create case insensitive unique constraint
Date: 2005-09-21 16:15:09
Message-ID: dgs1hn$lco$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I want to disable dupplicate customer names in a database regardless to
case.

I tried

CREATE TABLE customer ( id SERIAL, name CHARACTER(70));

ALTER TABLE customer
ADD constraint customer_name_unique UNIQUE (UPPER(name));

but this is not allowed in Postgres

Any idea ?

Andrus.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Csaba Nagy 2005-09-21 16:47:11 Re: How to create case insensitive unique constraint
Previous Message Lincoln Yeoh 2005-09-21 16:12:33 Re: Win32 Backup and Restore of large databases.