Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-494

DatabaseManager.process() unnecessarily limits range of DECIMAL or NUMERIC

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.2, 1.6.0
    • Fix Version/s: 1.7.0
    • Component/s: DSpace API
    • Labels:
      None
    • Environment:
      PostgreSQL
    • Attachments:
      2
    • Comments:
      4

      Description

      INTEGER, DECIMAL, and NUMERIC are lumped together. In the case we are using Oracle, the code will set the column to an int or a long depending on the size of the value. (I would like to know why we bother.) Otherwise the value is assumed to be within the range of int. But DECIMAL and NUMERIC can be far larger than int, and are returned by e.g. sum(BIGINT).

      The attached patch widens the result, in the non-Oracle case, to long for all three SQL datatypes. Strictly speaking, DECIMAL and NUMERIC should be mapped to java.math.BigDecimal, but that requires the introduction of new methods to TableRow as well. Widening from int to long probably covers most of the real-world cases. The patch is against 1.5.2 but also applies to 1.6.0-rc2.

      I would appreciate comments on how this widening may affect other code. The patch is in test on a live system, but in a locally-developed webapp rather than any of the main DSpace UIs.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mwood Mark H. Wood
                Reporter:
                mwood Mark H. Wood
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: