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

Subsequent calls to PreparedStatement cause SQLIntegrityConstraintViolationException on column that is "Generated always"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.3.2.1
    • 10.3.3.0, 10.4.1.3
    • SQL
    • None
    • gentoo linux amd64
    • Regression

    Description

      The following series of statements fails:

      j> connect 'jdbc:derby:test;create=true';
      ij> create table t (id int primary key generated always as identity);
      0 rows inserted/updated/deleted
      ij> prepare p as 'insert into t(id) values (default)';
      ij> execute p;
      1 row inserted/updated/deleted
      ij> execute p;
      ERROR 23505: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL080123140906700' defined on 'T'.

      There is a more detailed discussion about it here: http://www.nabble.com/Generate-Always-and-SQLIntegrityConstraintViolationException-td15012038.html#a15018054

      Attachments

        1. defaults.sql
          5 kB
          Dyre Tjeldvoll
        2. d3343.v3.diff
          4 kB
          Dyre Tjeldvoll
        3. d3343.v2.diff
          4 kB
          Dyre Tjeldvoll
        4. d3343.diff
          0.9 kB
          Knut Anders Hatlen

        Issue Links

          Activity

            People

              dyret Dyre Tjeldvoll
              wbecker William Becker
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: