Search Postgresql Archives

Failed to autoconvert '1' to text.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux