Closed hemberger closed 1 year ago
Previously the IfNullReturnTypeExtension was used for both IFNULL and NULLIF. However, these SQL functions should have different behavior.
IfNullReturnTypeExtension
NULLIF(expr1,expr2)
Returns NULL if expr1 = expr2 is true, otherwise returns expr1.
IFNULL(expr1,expr2)
If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2.
Note that IFNULL has additional type-mutating logic because it has to compare the two values in a temporary table:
IFNULL
The default return type of IFNULL(expr1,expr2) is the more "general" of the two expressions, in the order STRING, REAL, or INTEGER.
We now also require that the functions take exactly two arguments.
The typemix table is used for these tests since its column names clearly identify the column type (e.g. c_tinyint vs. gesperrt).
typemix
c_tinyint
gesperrt
thanks for the in detail discussion and your analysis. I really appreciate it.
Previously the
IfNullReturnTypeExtension
was used for both IFNULL and NULLIF. However, these SQL functions should have different behavior.NULLIF(expr1,expr2)
IFNULL(expr1,expr2)
Note that
IFNULL
has additional type-mutating logic because it has to compare the two values in a temporary table:We now also require that the functions take exactly two arguments.
The
typemix
table is used for these tests since its column names clearly identify the column type (e.g.c_tinyint
vs.gesperrt
).