Re: Make a column case insensitive

From: Rod Taylor <pg(at)rbt(dot)ca>
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-08 19:27:15
Message-ID: 1091993235.799.15.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 2004-08-06 at 11:29, 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 !)

You could make yourself a set returning function to do this job -- but
that is probably just as difficult to remember when selecting data out
of the table.

create function abc(text) returns set of tab as 'select * from tab where
col = lower($1);' language sql;

select * from abc('sEaRcH_VaLuE');

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Wegner 2004-08-08 20:39:29 Re: Make a column case insensitive
Previous Message Oliver Elphick 2004-08-08 01:06:36 Re: surrogate key or not?