Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-853

ResultSetMetaData.getScale returns inconsistent values for DOUBLE type.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 10.2.1.6
    • 10.13.1.0
    • JDBC
    • Normal
    • Newcomer, Repro attached

    Description

      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.

      Attachments

        1. Derby853.java
          0.7 kB
          Knut Anders Hatlen
        2. Derby-853.diff
          0.6 kB
          Danoja Dias
        3. Derby-853_2.diff
          2 kB
          Danoja Dias
        4. Derby-853_3.diff
          3 kB
          Danoja Dias
        5. BryanPossibleIdea.diff
          2 kB
          Bryan Pendleton

        Issue Links

          Activity

            People

              Dnj Danoja Dias
              djd Daniel John Debrunner
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: