Problem with function indexing
Hi,
I hate to resort to posting here but I got no responses
in the other groups. I am following up on an earlier
response on promotion of float4 to float8 in the WHERE
clause.
To get around this, Tom Lockhart suggested that I make a
function index on float8, but this is what happens:
final99=> create index mx on psc using btree (float8(glat) float8_ops);
ERROR: internal error: untrusted function not supported.
["psc" is my table and "glat" is a float4].
Any ideas how to do this? I have successfully made an index
on an externally linked function . . .
Thanks,
--Martin
===========================================================================
Martin Weinberg Phone: (413) 545-3821
Dept. of Physics and Astronomy FAX: (413) 545-2117/0648
530 Graduate Research Tower
University of Massachusetts
Amherst, MA 01003-4525
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 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
Import Notes
Reply to msg id not found: YourmessageofWed05May1999112217-0300199905051522.LAA22410@osprey.phast.umass.edu | Resolved by subject fallback