Re: Problem with create index

From: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with create index
Date: 2003-11-11 09:40:27
Message-ID: 200311111510.27873.mallah@trade-india.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 11 Nov 2003 2:00 pm, Stephan Szabo wrote:
> On Tue, 11 Nov 2003, Rajesh Kumar Mallah wrote:
> > Hmmm... am i doing anything really silly?
>
> Functional indexes on 7.3 and earlier only allow a function over one or
> more columns (which would disallow the below as a function over a function
> over a column). The usual workaround would be to make an immutable
> function that does both functions on its argument something like:
>
> create function lower_btrim(text) returns text as 'select
> lower(btrim($1));' language 'sql' immutable;
> create index profile_master2 on profile_master(lower_btrim(email));

Thanks for the work around

>
> In 7.4 I believe the below should work.
>
> > tradein_clients=# CREATE INDEX profile_master2 on profile_master (lower(
> > btrim(email) ) ); ERROR: parser: parse error at or near "(" at character
> > 61

Yes it does work

template1=# CREATE INDEX profile_master2 on t_a(lower(btrim(email)));
CREATE INDEX
template1=#
template1=# CREATE unique INDEX profile_master3 on t_a(lower(btrim(email)));
CREATE INDEX
template1=#

Regds
Mallah.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message C G 2003-11-11 11:02:51 Changing xml in a database
Previous Message Ma Siva Kumar 2003-11-11 08:43:21 multibyte support