Derby
  1. Derby
  2. DERBY-853

ResultSetMetaData.getScale returns inconsistent values for DOUBLE type.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Trivial Trivial
    • Resolution: Unresolved
    • Affects Version/s: 10.2.1.6
    • Fix Version/s: None
    • Component/s: JDBC
    • Urgency:
      Normal
    • Issue & fix info:
      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.

      1. Derby853.java
        0.7 kB
        Knut Anders Hatlen

        Activity

        Hide
        Rick Hillegas added a comment -

        Triaged for 10.5.3: assigne normal urgency.

        Show
        Rick Hillegas added a comment - Triaged for 10.5.3: assigne normal urgency.
        Hide
        Knut Anders Hatlen added a comment -

        Attaching Derby853.java which reproduces the problem. It subtracts a DOUBLE from a DECIMAL(10,2) and prints the scale and the type name of the result. On trunk, it prints:

        scale: 2
        type: DOUBLE

        Show
        Knut Anders Hatlen added a comment - Attaching Derby853.java which reproduces the problem. It subtracts a DOUBLE from a DECIMAL(10,2) and prints the scale and the type name of the result. On trunk, it prints: scale: 2 type: DOUBLE

          People

          • Assignee:
            Unassigned
            Reporter:
            Daniel John Debrunner
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development