PostgreSQL 9.6.17 COALESCE function error
I don't think you can &quot;fix&quot; this without changing your query or going back to Postgres 9.3, where apparently type casting rules were more relaxed.
date_part() returns a floating point value, and in the absence of an implicit type cast Postgres tries to convert the other operand of coalesce() to a compatible value, and an empty string ('') cannot be so converted.