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

Wrong functionality of auto-generated keys support

    Details

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

      Description

      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").

        Attachments

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

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                al0 Oleksandr Alesinskyy
              • Votes:
                6 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated: