Re: CREATE INDEX test_idx ON test (UPPER(varchar_field)) doesn't work...

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Philip Hallstrom <philip(at)adhesivemedia(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: CREATE INDEX test_idx ON test (UPPER(varchar_field)) doesn't work...
Date: 2000-08-10 04:49:34
Message-ID: Pine.BSF.4.10.10008092134460.62376-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 9 Aug 2000, Philip Hallstrom wrote:

> devloki=> SELECT UPPER(field) FROM test;
> upper
> ------------
> TEST STRIN
> (1 row)
>
> devloki=> CREATE INDEX test_idx ON test (field);
> CREATE
> devloki=> CREATE INDEX test_upper_idx ON test (UPPER(field));
> ERROR: DefineIndex: function 'upper(varchar)' does not exist
> --------------------------------------------------------------------------
>
> Is there any other information I can provide? Should I send this on to
> -bugs?

I think the reason for this is that the function is
upper(text) returns text. The select is willing to
do the type conversion for you but the index creation
is not.

I'm not 100% sure it's a good idea, but IIRC text and
varchar are binary compatible. You probably could
get away with adding an entry in pg_proc for
upper(varchar) returns varchar using the same function
by adding a new row with only the prorettype and proargtypes
changed.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas SB 2000-08-10 08:14:42 AW: VERY strange query plan (LONG)
Previous Message Philip Hallstrom 2000-08-10 03:54:25 CREATE INDEX test_idx ON test (UPPER(varchar_field)) doesn't work...