firebird icon indicating copy to clipboard operation
firebird copied to clipboard

Inconsitent automatic type casting for built-in scalar functions

Open kpnr opened this issue 1 year ago • 2 comments

Inconsistent behavior of automatic type casting with built-in scalar functions with numeric arguments. Almost all functions do automatic string-to-numeric type cast for arguments. Example: abs('-11') returns -11.0, sin('3.14') returns 0.002, etc...

But where are some exceptions, which are (probably) bugs. I've done some some tests with FB-3.0.11 and got this (I hope full) list:

  • round(x, y) - x (expression evaluation not supported)
  • substring(x from y for z) - y (expression evaluation not supported)
  • dateadd(x unit to y) - y (expression evaluation not supported)
  • datediff(unit from x to y) - x, y (expression evaluation not supported)
  • bin_and, bin_not, bin_or, bin_shl, bin_shr, bin_xor - all arguments (expression evaluation not supported)
  • extract(day from x) - x (Specified EXTRACT part does not exist in input datatype.)

Suggested fix: add automatic string-to-number (string-to-timestamp) type cast.

kpnr avatar Aug 08 '24 17:08 kpnr

It's better to test v5. It's very unlikely this type of change going to v3 when there are already two new major versions for some time.

asfernandes avatar Aug 08 '24 22:08 asfernandes

I retest cases with WI-V5.0.1.1469 Firebird 5.0 server. Got same results with same error messages.

kpnr avatar Aug 10 '24 18:08 kpnr