Tom Lane writes:
> Shall we abandon all that work and go back to "any available cast can be
> applied implicitly"?
>
> My vote is "tough, time to fix your SQL code".
That would be a OK if the current behavior conformed to the SQL standard,
which it doesn't. The standard says that all numerical types are mutually
assignable, which in my mind translates directly as implicitly castable.
Additionally, your stance breaks the following SQL compatible and probably
quite common code:
create table test ( a int extract(year from current_date) );
We aren't abandoning "all that work". Plenty of casts should not be
implicit because they are structurally guaranteed to lose information. But
for casts between numerical types it depends on the content at run time.
Therefore the SQL standard says that the check needs to be at run time.
We do that already, so I don't see a reason to be more strict here.
--
Peter Eisentraut peter_e@gmx.net