db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-853) ResultSetMetaData.getScale returns inconsistent values for DOUBLE type.
Date Sun, 31 Jul 2016 16:05:20 GMT

    [ https://issues.apache.org/jira/browse/DERBY-853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15401217#comment-15401217
] 

Bryan Pendleton commented on DERBY-853:
---------------------------------------

It seems like a good approach -- did it fix the Derby853.java test?

I think you are right that the problem is that we are using 'leftType',
which isn't correct in this case, because the type precedence rules
mean that at line 258 we have noticed that combining a DECIMAL and a
DOUBLE means we have a result of DOUBLE.

I wonder if there is a way to fix this somewhere near line 258 instead,
because it seems like at line 258 we shouldn't even be calling the
getScale() method if higherType is not a DECIMAL type, so maybe that
call get getScale() should be inside the "if" test at line 260?

bryan

> ResultSetMetaData.getScale returns inconsistent values for DOUBLE type.
> -----------------------------------------------------------------------
>
>                 Key: DERBY-853
>                 URL: https://issues.apache.org/jira/browse/DERBY-853
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.2.1.6
>            Reporter: Daniel John Debrunner
>            Assignee: Danoja Dias
>            Priority: Trivial
>              Labels: derby_triage10_5_2
>         Attachments: Derby-853.diff, Derby853.java
>
>
> If a DOUBLE column is returned in the result set then getScale() returns 0.
> If a DOUBLE expression is returned and the expression is the result of a DOUBLE combined
with a DECIMAL then it seems the scale from the decimal sometimes affects the result set metadata.
> E.g. DECIMAL(10,2) - DOUBLE returns a DOUBLE with getScale() returning 2.
> See the test output for jdbcapi/metadata.java
> double -- precision: 15 scale: 0 display size: 22 type name: DOUBLE
> double precision - dec(10,2) -- precision: 15 scale: 0 display size: 22 type name: DOUBLE
> dec(10,2) - double precision -- precision: 15 scale: 2 display size: 22 type name: DOUBLE
> First line is a DOUBLE column, second is DOUBLE - DECIMAL, third is DECIMAL - DOUBLE
> I assume the scale  should always be zero for a DOUBLE, as it holds no meaning, but I
can't see any proof of that in JDBC spec, javadoc or tutorial book.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message