Log Message: |
DERBY-853: ResultSetMetaData.getScale returns inconsistent values
This patch was contributed by Danoja Dias (danojadias at gmail dot com)
When a SQL statement contains arithmetic expressions, the result of the
expression may be of a different type than the operands to the expression,
due to type precedence rules which may require promoting the operand
values during evaluation of the expression.
For example, subtracting a DOUBLE from a DECIMAL results in a DOUBLE.
In some of these cases, Derby was reporting that the result column
had a non-zero scale, although the result column was not of DECIMAL type.
This change modifies the NumericTypeCompiler so that it only computes
a non-zero scale for the result column when it is of DECIMAL type.
|