Derby
  1. Derby
  2. DERBY-141 Derby metadata doesn't agree with JDBC specification in some ways.
  3. DERBY-2423

Embedded and client differ on ResultSetMetaData.isCurrency() value for DECIMAL and NUMERIC columns

    Details

    • Urgency:
      Low
    • Bug behavior facts:
      Embedded/Client difference

      Description

      Embedded returns true for ResultSetMetaData.isCurrency() for DECIMAL and NUMERIC columns. Client returns false. I tend to think client is right here but am not sure.

      1. derby-2423.diff
        3 kB
        Dyre Tjeldvoll

        Issue Links

          Activity

          Hide
          Myrna van Lunteren added a comment -

          bulk change to close all issues resolved but not closed and not changed since June 1, 2014.

          Show
          Myrna van Lunteren added a comment - bulk change to close all issues resolved but not closed and not changed since June 1, 2014.
          Hide
          ASF subversion and git services added a comment -

          Commit 1531821 from Dyre Tjeldvoll in branch 'code/trunk'
          [ https://svn.apache.org/r1531821 ]

          DERBY-2423: Make EmbedResultSetMetaData.isCrurrency() return false for DECIMAL and NUMERIC columns.

          Show
          ASF subversion and git services added a comment - Commit 1531821 from Dyre Tjeldvoll in branch 'code/trunk' [ https://svn.apache.org/r1531821 ] DERBY-2423 : Make EmbedResultSetMetaData.isCrurrency() return false for DECIMAL and NUMERIC columns.
          Hide
          Dyre Tjeldvoll added a comment -

          Lance Andersen (JDBC Spec Lead) says:

          I would probably return false as you really do not know if the column is really money unless the data type is really a specific type for it.

          So unless I hear objections I will commit the patch shortly.

          Show
          Dyre Tjeldvoll added a comment - Lance Andersen (JDBC Spec Lead) says: I would probably return false as you really do not know if the column is really money unless the data type is really a specific type for it. So unless I hear objections I will commit the patch shortly.
          Hide
          Dyre Tjeldvoll added a comment -

          Patch which suggested change.

          Show
          Dyre Tjeldvoll added a comment - Patch which suggested change.
          Hide
          Dyre Tjeldvoll added a comment -

          I agree that the client is probably correct here. It is difficult to find information about how this method is supposed to work. From googling I see that some clients use the value returned by this method to determine if the column value should be formatted as a currency.

          The JDBC Tutorial and Reference (JDBC 3.0) page 1073 mentions "...the common cases where DECIMAL and NUMERIC are used for currency values...", but I don't think this implies that isCurrency should always return true for these types.

          Table 50.7 JDBC Types Mapped to Database-specific SQL Types (also in the JDBC Tutorial) mentions that Sybase and Microsoft SQL Server has a MONEY type that is mapped to java.sql.Types.DECIMAL, and that Microsoft Access has a CURRENCY type that is mapped to java.sql.Types.NUMERIC.

          Seems reasonable to assume that the intention has been that isCurrency should return true for DECIMAL columns converted from MONEY and for NUMERIC columns converted from CURRENCY.
          By this reasoning isCurrency should always return false in Derby where there are no currency types.

          Changing this could have backward compatibility implications I guess.

          Show
          Dyre Tjeldvoll added a comment - I agree that the client is probably correct here. It is difficult to find information about how this method is supposed to work. From googling I see that some clients use the value returned by this method to determine if the column value should be formatted as a currency. The JDBC Tutorial and Reference (JDBC 3.0) page 1073 mentions "...the common cases where DECIMAL and NUMERIC are used for currency values...", but I don't think this implies that isCurrency should always return true for these types. Table 50.7 JDBC Types Mapped to Database-specific SQL Types (also in the JDBC Tutorial) mentions that Sybase and Microsoft SQL Server has a MONEY type that is mapped to java.sql.Types.DECIMAL, and that Microsoft Access has a CURRENCY type that is mapped to java.sql.Types.NUMERIC. Seems reasonable to assume that the intention has been that isCurrency should return true for DECIMAL columns converted from MONEY and for NUMERIC columns converted from CURRENCY. By this reasoning isCurrency should always return false in Derby where there are no currency types. Changing this could have backward compatibility implications I guess.

            People

            • Assignee:
              Dyre Tjeldvoll
              Reporter:
              Kathey Marsden
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development