db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: Triggers should be fired in the order they were created?
Date Thu, 12 Sep 2013 07:34:20 GMT
Mamta Satoor <msatoor@gmail.com> writes:

> Hi,
>
> I am working on DERBY-5866( testFiringConstraintOrder
> (org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)junit.framework.
> AssertionFailedError: matching triggers need to be fired in order
> creation:1,NO CASCADE BEFORE,DELETE,ROW). The test fixture
> testFiringConstraintOrder creates handful of triggers of various types
> and expects that the triggers will be fired in the order they were
> created. Intermittently, the test fails because the order of firing
> does not match order of creation. I will change the test such that the
> next intermittent failure will leave a database behind for further
> debugging. But I was wondering if anyone knows of a scenario when
> order of firing might not be same as order of creation. Or possibly,
> this is a bug?

Hi Mamta,

Triggers firing out of order is a bug.

The reference manual says they should be fired in the order of creation:

http://db.apache.org/derby/docs/10.10/ref/rrefsqlj43125.html

|   When multiple triggers are defined for the same database event for
|   the same table for the same trigger time (before or after), triggers
|   are fired in the order in which they were created.

Also, I found this in SQL:2003, part 2, section 4.38.1 General
description of triggers:

|   The order of execution of a set of triggers is ascending by value of
|   their timestamp of creation in their descriptors, such that the
|   oldest trigger executes first.


-- 
Knut Anders

Mime
View raw message