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

Reply via email to