Обсуждение: BUG #5799: failed to find conversion function from unknown to text

Поиск
Список
Период
Сортировка

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

От
"Sandro Santilli"
Дата:
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

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

От
Tom Lane
Дата:
"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