Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0014157Openbravo ERPY. DBSourceManagerpublic2010-08-10 12:272012-09-24 23:31
marvintm 
marvintm 
normalmajorhave not tried
scheduledopen 
5
 
 
Core
No
0014157: Check constraints should be disabled so that oncreatedefaults can work correctly
Check constraints currently are enabled when a table is created, or recreated, and never disabled after that. This works correctly in case there are no oncreatedefaults which affect the columns in the check, but fails when an oncreatedefault is supposed to fill a column which is needed by a check constraint.

Oncreatedefaults are executed at the end of the update process, after the Application Dictionary data has been updated. Therefore, there is a point in the update in which the check constraints could be temporarily violated (although the data would comply with the check at the end of the process). Thus, as it is currently, the process fails because the check constraint is activated at that point.

- Create a check constraint which affects a newly created column in the AD (which has an oncreatedefault).
- Install a module which doesn't have a value for that column. The process will fail.
The solution is obviously to disable the check constraints while the Application Dictionary data is being updated. This solution was already adopted with NOT NULL constraints (which have basically the same problem), and it makes sense to do it also for check constraints.
No tags attached.
related to design defect 0014020 scheduled marvintm oncreatedefaults which reference other columns from the same record are not correctly executed 
Issue History
2010-08-10 12:27marvintmNew Issue
2010-08-10 12:27marvintmAssigned To => marvintm
2010-08-11 09:30hgbotCheckin
2010-08-11 09:30hgbotNote Added: 0029880
2010-08-12 21:11hudsonbotCheckin
2010-08-12 21:11hudsonbotNote Added: 0029925
2010-08-16 08:11alostaleStatusnew => scheduled
2010-08-16 09:58hgbotCheckin
2010-08-16 09:58hgbotNote Added: 0029983
2010-08-16 10:02hgbotCheckin
2010-08-16 10:02hgbotNote Added: 0029988
2010-08-16 22:29hudsonbotCheckin
2010-08-16 22:29hudsonbotNote Added: 0030037
2012-01-30 17:54marvintmNote Added: 0044710
2012-01-30 17:54marvintmTypedefect => design defect
2012-09-10 15:50alostaleRelationship addedrelated to 0014020
2012-09-24 23:31AugustoMauchNote Added: 0052486
2012-09-24 23:31AugustoMauchPriorityurgent => normal

Notes
(0029880)
hgbot   
2010-08-11 09:30   
Repository: erp/devel/pi
Changeset: 401aaff3c6f6f3df6d2bc9af012f5179e3967267
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Aug 10 12:37:55 2010 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/401aaff3c6f6f3df6d2bc9af012f5179e3967267 [^]

[licensce] Tier constraint implemented as trigger

  DB check constraint for tier has been implemeted as trigger, due to
  issue 14157 the constraints are enabled before oncreatedefault is
  applied, so it fails installing old commercial modules.

---
M src-db/database/model/tables/AD_MODULE.xml
M src-db/database/model/triggers/AD_MODULE_VERSION_TRG.xml
---
(0029925)
hudsonbot   
2010-08-12 21:11   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/401aaff3c6f6 [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/dd00ba1c00c6 [^]
Tests: http://builds.openbravo.com/view/int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.18116.obx [^]
(0029983)
hgbot   
2010-08-16 09:58   
Repository: erp/devel/dbsm-main
Changeset: 2516e1a6419edc3b329d40147e3fbef00b199f8c
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Mon Aug 16 09:58:20 2010 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/2516e1a6419edc3b329d40147e3fbef00b199f8c [^]

Reverted change related to issue 14020.
Will do the change after the issue 14157 is fixed.

---
M src/org/apache/ddlutils/platform/SqlBuilder.java
---
(0029988)
hgbot   
2010-08-16 10:02   
Repository: erp/devel/pi
Changeset: 5faedaed0aafa587ca1f9e3302a86d2935a8fac5
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Mon Aug 16 10:02:04 2010 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/5faedaed0aafa587ca1f9e3302a86d2935a8fac5 [^]

Reverted change related to issue 14020.
Will do the change after the issue 14157 is fixed.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0030037)
hudsonbot   
2010-08-16 22:29   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/5faedaed0aaf [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/cb95e054be79 [^]
Tests: http://builds.openbravo.com/view/int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.18165.obx [^]
(0044710)
marvintm   
2012-01-30 17:54   
Although this change probably makes sense from a functional point of view, it would be very bad for performance reasons, and would also be very risky and likely to create regressions.

Changing this issue to design defect.
(0052486)
AugustoMauch   
2012-09-24 23:31   
Effort: 5
Impact: low
Plan: mid