Use of !~* to keep a varchar column UNIQUE case-insensitive - Mailing list pgsql-novice

From Don Morrison
Subject Use of !~* to keep a varchar column UNIQUE case-insensitive
Date
Msg-id aee6519f0608180938t59a30860mfbf706b0ba2d7f84@mail.gmail.com
Whole thread Raw
Responses Re: Use of !~* to keep a varchar column UNIQUE  (Sean Davis <sdavis2@mail.nih.gov>)
Re: Use of !~* to keep a varchar column UNIQUE case-insensitive  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Hello All,

Is there a sane way to do this?

I have a table with a column: "name VARCHAR(40) NOT NULL UNIQUE"

Two problems with this:

1)UNIQUE is case-sensitive
2)UNIQUE is whitespace sensitive

Has anyone come up with a way, or ways to trim leading and trailing
whitespace, then do a case-insensitive uniqueness check efficiently
and semi-elegantly?

If not, I can live with it...just hoping. :)

Thanks,
Don

pgsql-novice by date:

Previous
From: "ben sewell"
Date:
Subject: Function error- A column definition list is required for functions returning "record"
Next
From: Tom Lane
Date:
Subject: Re: Function error- A column definition list is required for functions returning "record"