Re: [HACKERS] Problem with function indexing - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Problem with function indexing
Date
Msg-id 6163.925947145@sss.pgh.pa.us
Whole thread Raw
In response to Problem with function indexing  (Martin Weinberg <weinberg@osprey.phast.umass.edu>)
List pgsql-hackers
Martin Weinberg <weinberg@osprey.phast.umass.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 saycreate 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] posmaster failed under high load
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] posmaster failed under high load