Thread: function to_char(unknown, unknown) is not unique
Hello.
When I'm trying to:
select to_char("ISDate", 'DD.MM.YYYY')::text from register."KSPT_view"
from table, containing nulls in "ISDate", i get nulls and formatted date as output.
But when I'm trying to:
select to_char(null, 'DD.MM.YYYY')::text
I get a error message:
ERROR: function to_char(unknown, unknown) is not unique
LINE 1: select to_char(null, 'DD.MM.YYYY')::text
^
HINT: Could not choose a best candidate function. You might need to add explicit type casts.
********** Error **********
ERROR: function to_char(unknown, unknown) is not unique
SQL state: 42725
Hint: Could not choose a best candidate function. You might need to add explicit type casts.
Character: 8
When I'm trying to:
select to_char("ISDate", 'DD.MM.YYYY')::text from register."KSPT_view"
from table, containing nulls in "ISDate", i get nulls and formatted date as output.
But when I'm trying to:
select to_char(null, 'DD.MM.YYYY')::text
I get a error message:
ERROR: function to_char(unknown, unknown) is not unique
LINE 1: select to_char(null, 'DD.MM.YYYY')::text
^
HINT: Could not choose a best candidate function. You might need to add explicit type casts.
********** Error **********
ERROR: function to_char(unknown, unknown) is not unique
SQL state: 42725
Hint: Could not choose a best candidate function. You might need to add explicit type casts.
Character: 8
hi,
Regards,
Bartek
try SELECT to_char(null::date, 'DD.MM.YYYY')::text or SELECT to_char(null::timestamp, 'DD.MM.YYYY')::text
should work.
It is not possible to guess type of null without explicit cast.
Regards,
Bartek
Ok, i have understand.
Select from table works because of type date of column.
Thanks!
Select from table works because of type date of column.
Thanks!
2012/12/10 Bartosz Dmytrak <bdmytrak@gmail.com>
hi,try SELECT to_char(null::date, 'DD.MM.YYYY')::text or SELECT to_char(null::timestamp, 'DD.MM.YYYY')::textshould work.It is not possible to guess type of null without explicit cast.
Regards,
Bartek