[ http://nagoya.apache.org/jira/browse/DERBY-7?page=comments#action_57093 ]
     
Christian d'Heureuse commented on DERBY-7:
------------------------------------------

I approve the fix and I agree that NULLIF(L,R) should return the data type of L 
(and does so with the fix).

But the proposed fix also affects the CASE expression.

 CASE WHEN BooleanExpression THEN thenExpression ELSE elseExpression END

The effect of the fix is that CASE accepts values that are not "type 
compatible" (for thenExpression and elseExpression), e.g. CHAR and INT.
CASE returns the "dominant" type of thenExpression and elseExpression (see 
DataTypeDescriptor.getDominantType()). The "dominant" type is the one that 
comes first in the list {USER-defined, BLOB, LONGVARBIT, ... CHAR} (according 
to the typePrecedence constants in TypeId.java). For DECIMAL/NUMERIC types, 
scale and precision are broadened to matche both input types.

The documentation of NULLIF and CASE in the reference manual should be 
complemented.
see http://incubator.apache.org/derby/manuals/reference/sqlj66.html
NULLIF is currently not explained at all.
For CASE, the formulation "a built-in broadening conversion must exist" should 
be extended and the data type of the result should be documented.

> Bug in NULLIF Function
> ----------------------
>
>          Key: DERBY-7
>          URL: http://nagoya.apache.org/jira/browse/DERBY-7
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Priority: Minor

>
> Reporting for Christian d'Heureuse, filed on derby-dev list.
> The NULLIF built-in function of Cloudscape 10.0.1.0 beta seems to accept
> only string values.
> Examples:
>  values nullif('a','b');
>  --> OK
>  values nullif(1,2);
>  --> Error message: "ERROR 42X89: Types 'CHAR' and
>      'INTEGER' are not type compatible. (Neither type
>      is assignable to the other type.)"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to