1. Derby
  2. DERBY-3609

Wrong functionality of auto-generated keys support


    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s:
    • Fix Version/s: None
    • Component/s: Documentation, JDBC
    • Environment:
    • Urgency:
    • Issue & fix info:
      High Value Fix, Repro attached
    • Bug behavior facts:
      Deviation from standard


      Currently support for autogeneration key retrieval in JDBC driver (java.sql.Statement) relies on IDENTITY_VAL_LOCAL function, which means that for multi-row INSERT... VALUES statements as well as for INSERT...AS SELECT statement wrong result are returned (key generated of last executed single-row INSERT...VALUES statement or NULL otherwise). While this functionality is documented in the Reference description of IDENTITY_VAL_LOCAL it is not so clearly documented in "autogenerated keys" subchapter of JDBC 3.0 Features (the only vague hint is "Calling ResultSet.getMetaData on the ResultSet object returned by getGeneratedKeys produces a ResultSetMetaData object that is similar to that returned by IDENTITY_VAL_LOCAL.").

      Moreover, as far as I understant it diverge from JDBC specification. IMHO or this functionality shal lbe implemented completely, or exception shall be thrown if for given statement functionality is not supported (e.g. "Feature not supported").

      1. generated-keys.diff
        2 kB
        Knut Anders Hatlen
        3 kB
        Oleksandr Alesinskyy

        Issue Links


          Oleksandr Alesinskyy created issue -
          Oleksandr Alesinskyy made changes -
          Field Original Value New Value
          Attachment [ 12379736 ]
          Kathey Marsden made changes -
          Derby Categories [High Value Fix]
          Dag H. Wanvik made changes -
          Issue & fix info [High Value Fix]
          Knut Anders Hatlen made changes -
          Bug behavior facts [Deviation from standard]
          Urgency Normal
          Issue & fix info [High Value Fix] [High Value Fix, Repro attached]
          Kathey Marsden made changes -
          Labels derby_triage10_5_2
          Kathey Marsden made changes -
          Labels derby_triage10_5_2 derby_triage10_11
          Gavin made changes -
          Workflow jira [ 12428541 ] Default workflow, editable Closed status [ 12802582 ]
          Knut Anders Hatlen made changes -
          Attachment generated-keys.diff [ 12611038 ]
          Kim Haase made changes -
          Link This issue is related to DERBY-6389 [ DERBY-6389 ]
          Knut Anders Hatlen made changes -
          Link This issue is related to DERBY-5823 [ DERBY-5823 ]
          Knut Anders Hatlen made changes -
          Component/s Documentation [ 11406 ]


            • Assignee:
              Oleksandr Alesinskyy
            • Votes:
              5 Vote for this issue
              7 Start watching this issue


              • Created: