Re: [SQL] Functional Indexes

From: Sascha Schumann <sas(at)schell(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bryan White <bryan(at)arcamax(dot)com>, pgsql-sql(at)hub(dot)org, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [SQL] Functional Indexes
Date: 1999-02-08 00:28:26
Message-ID: 19990208012826.A10851@schell.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

On Sat, Feb 06, 1999 at 12:27:47PM -0500, Tom Lane wrote:
> "Bryan White" <bryan(at)arcamax(dot)com> writes:
> > The documentation for CREATE INDEX implies that functions are allowed in
> > index definitions but when I execute:
> > create unique index idxtest on customer (lower(email));
> > the result is:
> > ERROR: DefineIndex: (null) class not found
> > Should this work? Do I have the syntax wrong?
>
> I tried this wih 6.4.2 and found that it was only accepted if I
> explicitly identified which index operator class to use:
>
> play=> create table customer (email text);
> CREATE
> play=> create unique index idxtest on customer (lower(email));
> ERROR: DefineIndex: class not found
> play=> create unique index idxtest on customer (lower(email) text_ops);
> CREATE
> play=>
>
> That'll do as a workaround for Bryan, but isn't this a bug? Surely
> the system ought to know what type the result of lower() is...
>
> regards, tom lane

I still have a problem with that ... edited typescript follows

funweb=> \d userdat
Table = userdat
+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| username | varchar() not null | 30 |
...
+----------------------------------+----------------------------------+-------+
Index: userdat_pkey
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.

--

Regards,

Sascha Schumann |
Consultant | finger sas(at)schell(dot)de
| for PGP public key

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 1999-02-08 00:35:19 Re: [HACKERS] Problems with >2GB tables on Linux 2.0
Previous Message Sascha Schumann 1999-02-08 00:15:19 Re: [HACKERS] v6.4.3 ?

Browse pgsql-sql by date

  From Date Subject
Next Message Marc Howard Zuckman 1999-02-08 02:42:23 Re: [SQL] Functional Indexes
Previous Message Jan Wieck 1999-02-06 17:39:54 Re: [SQL] Function returning multiple rows?