Re: [SQL] Functional Indexes - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [SQL] Functional Indexes
Date
Msg-id 13890.918443915@sss.pgh.pa.us
Whole thread Raw
In response to Re: [SQL] Functional Indexes  (Marc Howard Zuckman <marc@fallon.classyad.com>)
Responses Re: [SQL] Functional Indexes  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
Marc Howard Zuckman <marc@fallon.classyad.com> writes:
> On Mon, 8 Feb 1999, Sascha Schumann wrote:
>> funweb=> create unique index userdat_idx2 on userdat (lower(username)
>> varchar_ops);
>> ERROR:  BuildFuncTupleDesc: function 'lower(varchar)' does not exist
>>
>> This error message looks very bogus to me.

> I don't think lower is defined for varchar arguments.  consider redefining
> username as type text and using text_ops.

I think Marc is right.  Someone was working on adding lower() to the
available ops for varchar for 6.5, but it's not there in 6.4.

You can get lower() to work on varchar source data in a simple
SELECT, but that's some sort of hack that involves the system
knowing that text and varchar have the same physical representation
so it's OK to use a function that takes text on a varchar column.
The type matching requirements for functional indexes are tighter.

Note to hackers: is there a good reason why indexes are more
restrictive?  Offhand it seems like the same physical-equivalence
trick could be applied.

            regards, tom lane

pgsql-hackers by date:

Previous
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] strange behaviour on pooled alloc (fwd)
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Problems with >2GB tables on Linux 2.0