Subject Re: [firebird-support] The predicate where table1.timestamp1 > coalesce(table2.timestamp1, table2.timestamp2, '1.1.2006') does not work since Firebird 2.1
Author Dimitry Sibiryakov
> where h.log_tsc > coalesce(z.upd_tsc, z.create_tsc, '1.1.2006')
>
> It causes the error: "GDS Exception. 335544321. arithmetic exception,
> numeric overflow, or string truncation"
>
> Please clarify the situation.

I would guess that Firebird is trying to cast all arguments of
coalesce function to CHAR(8), which is type of '1.1.2008'. And because
fields are timestamps, they don't fit 8 chars.

SY, SD.

PS: You can use specification "_timestamp" instead of CAST. I.e.
coalesce(z.upd_tsc, z.create_tsc, _timestamp '1.1.2006')