ERROR: function to_char is not unique


Postgres 9.3.6 made some changes to the TO_CHAR() function. Specifically, there are two new restrictions.

Note: You can also use DATE_TRUNC to format dates instead of TO_CHAR.

1. You cannot convert a string date to a string
Be sure your date in TO_CHAR is of type date, convert if needed.


TO_CHAR('2014-01-01', 'YYYY-MM') should be TO_CHAR('2014-01-01'::date, 'YYYY-MM')

2. You cannot compare a string to a date, or vice versa
In where filters, make sure the column name and comparison values are either all type text or all type date.

Related Charts Help Articles

See more