db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6348) NPE or assert failure in recursive trigger
Date Wed, 18 Sep 2013 12:30:52 GMT

    [ https://issues.apache.org/jira/browse/DERBY-6348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13770720#comment-13770720
] 

Knut Anders Hatlen commented on DERBY-6348:
-------------------------------------------

It only seems to happen if one of the triggers that fire before the recursive trigger, has
a trigger action that returns rows. See the TR1 trigger in the repro, where the trigger action
is VALUES 1.

That particular trigger is of course rather pointless, but there are use cases where it makes
sense to have a VALUES statement in the trigger action. For instance, the first example in
the reference manual's CREATE TRIGGER statement topic shows how to call a function with side-effects
from a trigger action using a VALUES statement.
                
> NPE or assert failure in recursive trigger
> ------------------------------------------
>
>                 Key: DERBY-6348
>                 URL: https://issues.apache.org/jira/browse/DERBY-6348
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.6.1.0, 10.7.1.1, 10.8.1.2, 10.9.1.0, 10.10.1.1
>            Reporter: Knut Anders Hatlen
>
> With 10.5.1.1 and newer, the following ij session fails with a NullPointerException (production
jars) or an assert failure (debug jars):
> ij version 10.10
> ij> connect 'jdbc:derby:db;create=true';
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values 0;
> 1 row inserted/updated/deleted
> ij> create trigger tr1 after update on t values 1;
> 0 rows inserted/updated/deleted
> ij> create trigger tr2 after update on t for each row update t set x = x + 1 where
x < 3;
> 0 rows inserted/updated/deleted
> ij> update t set x = x + 1;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> It does not fail on 10.4.2.0:
> ij version 10.4
> ij> connect 'jdbc:derby:db;create=true';
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values 0;
> 1 row inserted/updated/deleted
> ij> create trigger tr1 after update on t values 1;
> 0 rows inserted/updated/deleted
> ij> create trigger tr2 after update on t for each row update t set x = x + 1 where
x < 3;
> 0 rows inserted/updated/deleted
> ij> update t set x = x + 1;
> 1 row inserted/updated/deleted
> ij> select * from t;
> X          
> -----------
> 3          
> 1 row selected

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message