Asier, the "other ones" should be reviewed by Adrian. Ismael
-----Mensaje original----- De: Asier Lostale [mailto:[email protected]] Enviado el: jueves, 11 de marzo de 2010 11:14 Para: [email protected] Asunto: [Openbravo-development] Trigger execution Hi all, Fixing this issue [1], I've realized that triggers work in a slightly different way between Oracle and PostrgreSQL: -Oracle: 1."before" triggers are executed 2. "after" triggers are executed 3. constraints are verified -PostgreSQL 1."before" triggers are executed 2. constraints are verified 3. "after" triggers are executed This means that triggers to be executed on delete that are used to do cascade deletions (as the one reported in the issue), in Oracle can be defined as before or after, but in Postgre they will not work unless they are "before". Looking in the core code I've found these candidates to be reviewed: grep -i 'delete\s*from' `grep -l 'fires="after".*delete="true"' *` AD_REFERENCE_TRG2.xml: DELETE FROM AD_MODEL_OBJECT_MAPPING WHERE AD_MODEL_OBJECT_ID IN ( AD_REFERENCE_TRG2.xml: DELETE FROM AD_MODEL_OBJECT WHERE ACTION = 'S' AND AD_MODEL_OBJECT.AD_REFERENCE_ID = :OLD.AD_REFERENCE_ID; AD_TAB_TRG2.xml: DELETE FROM AD_MODEL_OBJECT_MAPPING WHERE AD_MODEL_OBJECT_ID IN ( AD_TAB_TRG2.xml: DELETE FROM AD_MODEL_OBJECT WHERE ACTION = 'W' AND AD_MODEL_OBJECT.AD_TAB_ID = :OLD.AD_TAB_ID; C_BPARTNER_TRG.xml: DELETE FROM AD_TreeNodeBP WHERE AD_Client_ID = :old.AD_Client_ID AND Node_ID = :old.C_BPartner_ID; C_INVOICELINETAX_TRG.xml: DELETE FROM C_INVOICETAX C_INVOICELINE_TRG2.xml: DELETE FROM C_INVOICELINE_OFFER C_INVOICELINE_TRG2.xml: DELETE FROM C_INVOICELINETAX WHERE C_INVOICELINE_ID = :new.C_InvoiceLine_ID; C_ORDERLINETAX_TRG.xml: DELETE FROM C_ORDERTAX C_ORDERLINE_TRG2.xml: DELETE FROM C_ORDERLINE_OFFER C_ORDERLINE_TRG2.xml: DELETE FROM C_ORDERLINETAX WHERE C_ORDERLINE_ID = :new.C_OrderLine_ID; M_PRODUCT_TRG.xml: DELETE FROM AD_TreeNodePR WHERE AD_Client_ID = :old.AD_Client_ID AND Node_ID = :old.M_Product_ID; I will review and fix the platform ones (ad_reference_trg2, ad_tab_trg2), and I'd like to someone else to review the other ones. You also should take this note into account when creating new triggers. Regards Asier [1] https://issues.openbravo.com/view.php?id=12601 ---------------------------------------------------------------------------- -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Openbravo-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-development ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Openbravo-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-development
