[ 
https://issues.apache.org/jira/browse/DERBY-853?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bryan Pendleton updated DERBY-853:
----------------------------------
    Attachment: BryanPossibleIdea.diff

Hi Danoja,

I was wondering if you could look at a slight variation on your patch,
which I have attached as "BryanPossibleIdea.diff".

It is very similar to your patch, with two differences:

1) If the higher-precedence type isn't DECIMAL, I changed it to
simply set the scale to 0. I don't think it matters terribly much whether
the alternate type is DOUBLE, or BIGINT, or any other type; if it's
not DECIMAL, the scale should be 0.

2) I also added a test of getPrecision to the test case that you
added to confirm that, whichever order the arguments are in
the test case, the precision still comes back 15. I didn't discover
any new problem; I just added the additional assertion on getPrecision

What do you think about this idea?

For me, it passes your new test case, and it also passes all
the existing test suites.

thanks,

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: BryanPossibleIdea.diff, Derby-853.diff, 
> Derby-853_2.diff, Derby-853_3.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)

Reply via email to