db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yip Ng (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-1621) Trigger action statement is not recompile when there is a change that would affect it.
Date Wed, 16 Aug 2006 00:57:15 GMT
     [ http://issues.apache.org/jira/browse/DERBY-1621?page=all ]

Yip Ng updated DERBY-1621:
--------------------------

    Attachment: derby1621trunkstat04.txt
                derby1621trunkdiff04.txt

Attaching patch derby1621trunkdiff04.txt to reflect latest changes in trunk.  In summary this
patch should address some of the trigger recompilation issues that I have encountered.

1)  Trigger does not get invalidated when the underlying objects it references get modified
or invalidated.  - resolved.

2)  SPS recompilation may use internal nested transaction and user transaction to update system
tables.  If the user transaction rolls back due to a constraint violation, the SYSDEPENDS
row entries will also be removed, leaving the catalog in an inconsistent state. - resolved.

3)  In transaction mode, if a SPS recompilation occurs, the nested transaction that updates
the SYSDEPENDS table might still wait for lock.  An improvement would be to allow:
a)  Fetch with NOWAIT in store  or
b)  Update to system tables should be done using internal system transaction.  
-  Will file a jira improvement for this.

Let's move this patch forward for review.  


> Trigger action statement is not recompile when there is a change that would affect it.
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-1621
>                 URL: http://issues.apache.org/jira/browse/DERBY-1621
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.0.0
>            Reporter: Daniel John Debrunner
>         Assigned To: Yip Ng
>            Priority: Critical
>             Fix For: 10.2.0.0
>
>         Attachments: derby1621trunkdiff01.txt, derby1621trunkdiff02.txt, derby1621trunkdiff03.txt,
derby1621trunkdiff04.txt, derby1621trunkstat01.txt, derby1621trunkstat02.txt, derby1621trunkstat03.txt,
derby1621trunkstat04.txt
>
>
> A trigger action statement, such as an INSERT statement is not recompiled when there
is some DDL change on the underlying table, such as a CREATE INDEX.
> In the example below a unique index is added to the table (t2) inserted into by the trigger's
action statement. When the tirgger fires it does not raise any error (should raise a unique
constraint violated error) and does not insert the value into the index. A select from t2
does not show the additional rows in t2 as it is performing an index scan, once the index
is dropped the rows appear to the select.
> ij version 10.2
> ij> connect 'jdbc:derby:cs;create=true';
> ij> create table t (i int);
> 0 rows inserted/updated/deleted
> ij> create table t2 (i int);
> 0 rows inserted/updated/deleted
> ij> create trigger tt after insert on t for each statement mode db2sql
> insert into t2 values 1;
> 0 rows inserted/updated/deleted
> ij> insert into t values 1;
> 1 row inserted/updated/deleted
> ij> select * from t2;
> I
> -----------
> 1
> 1 row selected
> ij> create unique index tu on t2(i);
> 0 rows inserted/updated/deleted
> ij> insert into t values 1;
> 1 row inserted/updated/deleted
> ij> select * from t2;
> I
> -----------
> 1
> 1 row selected
> ij> insert into t values 1;
> 1 row inserted/updated/deleted
> ij> select * from t2;
> I
> -----------
> 1
> 1 row selected
> ij> drop index tu;
> 0 rows inserted/updated/deleted
> ij> select * from t2;
> I
> -----------
> 1
> 1
> 1
> 3 rows selected

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message