Re: Make a column case insensitive

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Gordon Ross <G(dot)Ross(at)ccw(dot)gov(dot)uk>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Make a column case insensitive
Date: 2004-08-09 03:40:35
Message-ID: 4116F233.5040402@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 8/6/2004 11:29 AM, Gordon Ross wrote:

> Is it possible to make a column case insensitive, without having to pepper your SELECTs with lots of lower() function calls (and forgetting to do it at times !)
>
> (I'm on 7.4.3)

With a little bit of legwork you can create an itext data type. It would
just use textin() and textout() for the data type declaration itself.
From there you'd define a bunch of comparision operators that are based
on sql functions doing case insensitive comparision, plus an operator
class and a couple of implicit casts. I don't think you'd even need a
single line of C code for that new data type.

Jan

>
> Thanks,
>
> GTG
>
> Gordon Ross,
> Network Manager/Rheolwr Rhydwaith
> Countryside Council for Wales/Cyngor Cefn Gwlad Cymru
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pierre-Frédéric Caillaud 2004-08-09 06:09:05 Re: Make a column case insensitive
Previous Message Michael Glaesemann 2004-08-08 23:55:58 Re: UNIQUE constraint