Failed to autoconvert '1' to text.

Поиск
Список
Период
Сортировка
От Szymon Guz
Тема Failed to autoconvert '1' to text.
Дата
Msg-id CAFjNrYu1jvA0NkR8A+5ckxW0wLv_DP2oLnFk2qZjJfi1p92B8w@mail.gmail.com
обсуждение исходный текст
Ответы Re: Failed to autoconvert '1' to text.  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
Hi,
why isn't 'aa' always treated as string?

While testing function for levenshtein distance I've noticed that:

with x as (
  select 
  '1' a,
  '2' b
)
SELECT levenshtein(a, b), length(a)
FROM x;

ERROR:  failed to find conversion function from unknown to text

with x as (
  select 
  '1'::TEXT a,
  '2'::TEXT b
)
SELECT levenshtein(a, b), length(a)
FROM x;

 levenshtein | length 
-------------+--------
           1 |      1
(1 row)


Why should I cast '1' to '1'::TEXT to satisfy a function (TEXT, TEXT)?

thanks,
Szymon

В списке pgsql-general по дате отправления:

Предыдущее
От: Boszormenyi Zoltan
Дата:
Сообщение: Re: Is this a bug in ECPG?
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Failed to autoconvert '1' to text.