Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0032011Openbravo ERPY. DBSourceManagerpublic2016-01-26 11:452016-03-17 10:55
AugustoMauch 
AugustoMauch 
normalmajorhave not tried
closedfixed 
5
 
3.0PR16Q2 
alostale
Core
No
0032011: Allow to recreate a trigger specifying a list of triggers to follow (only applicable in Oracle)
The trigger execution order is handled differently in Postgres and Oracle:
- Postgres: Triggers are executed alphabetically [1]
- Oracle: From Oracle 11, the order of the triggers can be specified using the FOLLOWS clause [2].

A new development in progress adds triggers to the Openbravo tables. Those triggers must be invoked after the Openbravo triggers of the same type defined in those tables. In Postgres this can be handled by naming properly the new triggers, but in Oracle it is required to recreate the affected OB triggers, adding a FOLLOWS clause to force that they are invoked before the new ones.

This case would be covered if the Platform offered a way to recreate a trigger specifying a list of triggers that should be executed after it.


[1] "If multiple triggers of the same kind are defined for the same event, they will be fired in alphabetical order by name." http://www.postgresql.org/docs/9.4/static/sql-createtrigger.html [^]
[2] http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/create_trigger.htm#CJADJGIF [^]
-
No tags attached.
Issue History
2016-01-26 11:45AugustoMauchNew Issue
2016-01-26 11:45AugustoMauchAssigned To => AugustoMauch
2016-01-26 11:45AugustoMauchModules => Core
2016-01-26 11:45AugustoMauchTriggers an Emergency Pack => No
2016-01-29 14:17AugustoMauchReview Assigned To => alostale
2016-01-29 14:33hgbotCheckin
2016-01-29 14:33hgbotNote Added: 0083737
2016-01-29 14:33hgbotStatusnew => resolved
2016-01-29 14:33hgbotResolutionopen => fixed
2016-01-29 14:33hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/dbsm-main/rev/1f0f7d2678744ee4a80cef520cd821501b304612 [^]
2016-01-29 14:33hgbotCheckin
2016-01-29 14:33hgbotNote Added: 0083738
2016-01-29 14:33hgbotCheckin
2016-01-29 14:33hgbotNote Added: 0083739
2016-01-29 14:35hgbotCheckin
2016-01-29 14:35hgbotNote Added: 0083740
2016-01-29 14:35hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/dbsm-main/rev/1f0f7d2678744ee4a80cef520cd821501b304612 [^] => http://code.openbravo.com/erp/devel/pi/rev/2dd2efccfcc61f4f933983c9c15c0c79937b503d [^]
2016-02-05 09:01alostaleNote Added: 0083949
2016-02-05 09:01alostaleStatusresolved => closed
2016-02-05 09:01alostaleFixed in Version => 3.0PR16Q2
2016-03-17 10:55hudsonbotCheckin
2016-03-17 10:55hudsonbotNote Added: 0085092

Notes
(0083737)
hgbot   
2016-01-29 14:33   
Repository: erp/devel/dbsm-main
Changeset: 1f0f7d2678744ee4a80cef520cd821501b304612
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Jan 26 16:26:10 2016 +0100
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/1f0f7d2678744ee4a80cef520cd821501b304612 [^]

Fixes issue 32011: Trigger can be recreated with triggers to follow list (ORA)

Now it is possible to recreate an existing trigger, specifying a list of triggers of the same type that should be invoked before it. This development only affects Oracle database
s, as in postgres the trigger execution order is given by the trigger's name.

The Oracle8Builder has been updated to include a follows clause if the trigger being created must be executed before it. For instance, to create a trigger named TEST_TRIGGER_SECO
ND that must be executed after a trigger called TEST_TRIGGER_FIRST, the builder constructs the following statement:

CREATE TRIGGER TEST_TRIGGER_FIRST
AFTER INSERT OR UPDATE
ON TEST FOR EACH ROW
FOLLOWS TEST_TRIGGER_SECOND
DECLARE
BEGIN
END TEST_TRIGGER_FIRST
;

---
M src/org/apache/ddlutils/Platform.java
M src/org/apache/ddlutils/platform/PlatformImplBase.java
M src/org/apache/ddlutils/platform/SqlBuilder.java
M src/org/apache/ddlutils/platform/oracle/Oracle8Builder.java
M src/org/apache/ddlutils/platform/oracle/Oracle8Platform.java
---
(0083738)
hgbot   
2016-01-29 14:33   
Repository: erp/devel/dbsm-main
Changeset: f774e5af33b8bfa70a3698ed785b104596884d0b
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Jan 26 16:34:05 2016 +0100
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/f774e5af33b8bfa70a3698ed785b104596884d0b [^]

Related with issue 32011: Adds test to check the FOLLOWS clause in Oracle

The test checks that a trigger can be recreated in Oracle, providing a list of triggers of the same type that should be invoked before it, and it results on a FOLLOWS clause [1] being added to the trigger.

[1] http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/create_trigger.htm#CJADJGIF [^]

---
M src-test/src/org/openbravo/dbsm/test/model/ModelSuite.java
A src-test/model/triggers/TABLE_WITH_TWO_TRIGGERS.xml
A src-test/src/org/openbravo/dbsm/test/model/CheckFollowsClauseCanBeDefinedInOracleTriggers.java
---
(0083739)
hgbot   
2016-01-29 14:33   
Repository: erp/devel/dbsm-main
Changeset: 35c9dae4b4aed97592723b5e12072ed2e9fe4c9c
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Fri Jan 29 14:06:43 2016 +0100
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/35c9dae4b4aed97592723b5e12072ed2e9fe4c9c [^]

Related with issue 32011: Removes extra space after FOLLOWS clause

The CheckFollowsClauseCanBeDefinedInOracleTriggers test has been updated to take into account the extra space removal.

---
M src-test/src/org/openbravo/dbsm/test/model/CheckFollowsClauseCanBeDefinedInOracleTriggers.java
M src/org/apache/ddlutils/platform/oracle/Oracle8Builder.java
---
(0083740)
hgbot   
2016-01-29 14:35   
Repository: erp/devel/pi
Changeset: 2dd2efccfcc61f4f933983c9c15c0c79937b503d
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Fri Jan 29 14:31:54 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/2dd2efccfcc61f4f933983c9c15c0c79937b503d [^]

Fixes issue 32011: Trigger can be recreated with triggers to follow list (ORA)

Now it is possible to recreate an existing trigger, specifying a list of triggers of the same type that should be invoked before it. This development only affects Oracle database
s, as in postgres the trigger execution order is given by the trigger's name.

The Oracle8Builder has been updated to include a follows clause if the trigger being created must be executed before it. For instance, to create a trigger named TEST_TRIGGER_SECO
ND that must be executed after a trigger called TEST_TRIGGER_FIRST, the builder constructs the following statement:

CREATE TRIGGER TEST_TRIGGER_FIRST
AFTER INSERT OR UPDATE
ON TEST FOR EACH ROW
FOLLOWS TEST_TRIGGER_SECOND
DECLARE
BEGIN
END TEST_TRIGGER_FIRST
;

---
M src-db/database/lib/dbsourcemanager.jar
---
(0083949)
alostale   
2016-02-05 09:01   
code reviewed + tested
(0085092)
hudsonbot   
2016-03-17 10:55   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/b22fb0500156 [^]
Maturity status: Test