Re: [HACKERS] Problem with function indexing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martin Weinberg <weinberg(at)osprey(dot)phast(dot)umass(dot)edu>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Problem with function indexing
Date: 1999-05-05 23:32:25
Message-ID: 6163.925947145@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Martin Weinberg <weinberg(at)osprey(dot)phast(dot)umass(dot)edu> writes:
> final99=> create index mx on psc using btree (float8(glat) float8_ops);
> ERROR: internal error: untrusted function not supported.

The trouble here is that in 6.4.*, float4-to-float8 is an SQL alias
function, and you can't use an SQL function as the guts of an index.
(I know, the error message is misleading.)

Looking in pg_proc shows that the underlying built-in function is named
"ftod":

play=> select proname,prosrc from pg_proc where proname = 'float8' and
play-> pg_proc.proargtypes[0] = 700;
proname|prosrc
-------+---------------
float8 |select ftod($1)
(1 row)

so if you say
create index mx on psc using btree (ftod(glat) float8_ops);
it should work.

(BTW, in 6.5 this little fine point goes away, since all the aliases of
a built-in function are equally built-in.)

regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-05-06 00:25:24 Re: [HACKERS] posmaster failed under high load
Previous Message Tom Lane 1999-05-05 23:09:43 Re: [HACKERS] posmaster failed under high load