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

Nested triggers not working properly after maximum trigger count exception is thrown

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.1.3.1, 10.2.1.6, 10.3.1.4
    • 10.2.2.1, 10.3.1.4
    • SQL
    • None
    • Any

    Description

      After the maximum allowed nested trigger exception is thrown, subsequent statement that result in nested trigger execution may result in the same error again even though it does not exceed the limit of nested triggers(16).
      e.g.:

      C:\derby\trunk>java -classpath classes;. org.apache.derby.tools.ij

      ij version 10.3
      ij> connect 'jdbc:derby:wombat;create=true';
      ij> create table t1 (i int);
      0 rows inserted/updated/deleted
      ij> insert into t1 values 1,2,3;
      3 rows inserted/updated/deleted
      ij> create trigger tr1 after update on t1 for each row update t1 set i=i+1;
      0 rows inserted/updated/deleted
      – force the "maximum depth of nested triggers" error to occur
      ij> update t1 set i=i+1;
      ERROR 54038: Maximum depth of nested triggers was exceeded.
      ij> drop trigger tr1;
      0 rows inserted/updated/deleted
      ij> create trigger tr1 after update on t1 referencing old as oldt for each row update t1 set i=i+1 where oldt.i=2;
      0 rows inserted/updated/deleted
      – this should have executed successfully instead of throwing the same error again!
      ij> update t1 set i=i+1;
      ERROR 54038: Maximum depth of nested triggers was exceeded.
      ij> disconnect;
      ij> connect 'jdbc:derby:wombat';
      ij> select * from t1;
      I
      -----------
      1
      2
      3

      3 rows selected
      – ok after reconnection, it looks like the trigger execution context(TEC) may not have been cleanup properly in the previous connection
      ij> update t1 set i=i+1;
      3 rows inserted/updated/deleted
      ij> select * from t1;
      I
      -----------
      4
      5
      6

      3 rows selected
      ij>

      Attachments

        1. derby2195-trunk-diff01.txt
          7 kB
          Yip Ng
        2. derby2195-trunk-stat01.txt
          0.3 kB
          Yip Ng
        3. derby2195-10.2-stat01.txt
          0.3 kB
          Yip Ng
        4. derby2195-10.2-diff01.txt
          7 kB
          Yip Ng

        Issue Links

          Activity

            People

              yipng Yip Ng
              yipng Yip Ng
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: