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

Deferred constraint validation fails with "dead statement" when query plan logging is enabled

    XMLWordPrintableJSON

    Details

    • Issue & fix info:
      Repro attached

      Description

      Run the following script with the derby.language.logQueryPlan system property set to true:

      connect 'jdbc:derby:memory:db;create=true';
      create table t1(x int primary key);
      create table t2(y int, constraint c check(y > 0) initially deferred, constraint fk foreign key(y) references t1 initially deferred);
      autocommit off;
      insert into t1 values -1, 1;
      insert into t2 values 1;
      update t2 set y = -1;
      delete from t1 where x = -1;
      commit;
      

      The commit statement will fail with the following error message: "ERROR 40XC0: Dead statement. This may be caused by catching a transaction severity error inside this statement."

      If you run the script without setting the derby.language.logQueryPlan system property, it will fail (correctly) with this error message: "ERROR 23514: The transaction was aborted because of a deferred constraint violation: Check constraint identified by 'C' defined on "APP"."T2" as '(y > 0)'."

        Attachments

        1. derby-6666c.diff
          8 kB
          Dag H. Wanvik
        2. derby-6666b.diff
          7 kB
          Dag H. Wanvik
        3. derby-6666.diff
          2 kB
          Dag H. Wanvik

          Activity

            People

            • Assignee:
              dagw Dag H. Wanvik
              Reporter:
              knutanders Knut Anders Hatlen
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: