BUG #5799: failed to find conversion function from unknown to text

Started by strkover 15 years ago2 messagesbugs
Jump to latest
#1strk
strk@keybit.net

The following bug has been logged online:

Bug reference: 5799
Logged by: Sandro Santilli
Email address: strk@keybit.net
PostgreSQL version: 8.4.3
Operating system: GNU/Linux 64bit
Description: failed to find conversion function from unknown to text
Details:

Function definition:

CREATE OR REPLACE FUNCTION ST_RelateMatch(text, text)
RETURNS bool
AS '$libdir/postgis-2.0', 'ST_RelateMatch'
LANGUAGE 'C' IMMUTABLE STRICT
COST 100;

Function invocation:

SELECT a, b, ST_RelateMatch(a,b) FROM
( SELECT '101202FFF' as a, 'TTTTTTFFF' as b) as f;

Results in:

ERROR: failed to find conversion function from unknown to text

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: strk (#1)
Re: BUG #5799: failed to find conversion function from unknown to text

"Sandro Santilli" <strk@keybit.net> writes:

SELECT a, b, ST_RelateMatch(a,b) FROM
( SELECT '101202FFF' as a, 'TTTTTTFFF' as b) as f;
Results in:
ERROR: failed to find conversion function from unknown to text

Cast those unknown literals to text explicitly, ie

SELECT a, b, ST_RelateMatch(a,b) FROM
( SELECT '101202FFF'::text as a, 'TTTTTTFFF'::text as b) as f;

We don't support doing it the other way because retroactively deciding
at the top level that the sub-select's outputs should have been text
might change the semantics of the sub-select (consider cases involving
DISTINCT for example).

regards, tom lane