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

Trigger should register a dependency on tables and columns used in its body

    XMLWordPrintableJSON

Details

    • Normal
    • Release Note Needed, Repro attached

    Description

      A trigger registers a dependency in the Dependency Manager for those columns which cause the firing of the trigger, but does not register a dependency on tables and columns which are used in the body of the trigger. This means that the trigger may unexpectedly become invalid due to a change to one of those tables and columns in its body, and the user may be surprised that Derby did not warn them of this problem when the underlying table/column change was made.

      An example of this problem is as follows:

      create table t1 (c1 int);
      create table t2 (c2 int);
      create trigger tr1 after update of c1 on t1 for each row mode db2sql insert into t2 (c2) values (1);

      With this set of definitions, Derby will warn/prevent the user about changes to table t1 and column c1, but will not warn the user about changes to table t2 and column c2. If the user drops or renames t2 or c2, the trigger will then give an error the next time it fires.

      It seems like it would be an improvement for the trigger to record this dependency on table t2 and column c2.

      Attachments

        1. d2041-1a.diff
          64 kB
          Knut Anders Hatlen
        2. d2041-1b.diff
          69 kB
          Knut Anders Hatlen
        3. d2041-2a-upgrade-test.diff
          9 kB
          Knut Anders Hatlen
        4. register-dependencies.diff
          20 kB
          Knut Anders Hatlen
        5. releaseNote.html
          3 kB
          Richard N. Hillegas
        6. releaseNote.html
          5 kB
          Knut Anders Hatlen

        Issue Links

          Activity

            People

              knutanders Knut Anders Hatlen
              bryanpendleton Bryan Pendleton
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: