Re: [SQL] Functional Indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marc Howard Zuckman <marc(at)fallon(dot)classyad(dot)com>
Cc: pgsql-sql(at)hub(dot)org, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [SQL] Functional Indexes
Date: 1999-02-08 03:18:35
Message-ID: 13890.918443915@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Marc Howard Zuckman <marc(at)fallon(dot)classyad(dot)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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-02-08 03:48:31 Re: [SQL] Functional Indexes
Previous Message Vadim Mikheev 1999-02-08 03:12:15 Re: [HACKERS] strange behaviour on pooled alloc (fwd)

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 1999-02-08 03:48:31 Re: [SQL] Functional Indexes
Previous Message Marc Howard Zuckman 1999-02-08 02:42:23 Re: [SQL] Functional Indexes