Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0034048Openbravo ERPA. Platformpublic2016-09-21 16:312016-09-23 09:34
caristu 
platform 
highmajoralways
closedinvalid 
5
 
 
Core
No
0034048: Not null constraint removed from database under some circumnstances
A not null constraint defined for a column of an AD table disappears when AD XML files are older than new column definition, if that column does not have an oncreatedefault.
1) Install the attached patch which adds a new test column to the OBUIAPP_Report table (this is an AD table)

2) Install the following module: https://code.openbravo.com/erp/mods/org.openbravo.platform.features/ [^] this module contains some sourcedata for the OBUIAPP_Report table which obviously does not define any value for the test column

3) Notice that after the execution of the update.database task, the NOT NULL constraint is gone for the test column in the database. In addition, the following error is displayed:

     [java] 38957 INFO - Batch statement failed. Rolling back and retrying all the statements in a non-batched connection.
     [java] 46518 WARN - SQL Command failed with: ERROR: column "test" contains null values
     [java] 46528 WARN - -- END
     [java] ALTER TABLE OBUIAPP_REPORT ALTER TEST SET NOT NULL
     [java] 48633 INFO - Executed 886 SQL command(s) with 1 error(s)


Note: this error can be workarounded by defining an onCreateDefault[1] for the column.

[1] http://wiki.openbravo.com/wiki/How_to_define_an_on_Create_Default [^]
No tags attached.
related to feature request 0029270 closed alostale prevent table recreation in update.database 
diff testColumn.diff (4,461) 2016-09-21 17:32
https://issues.openbravo.com/file_download.php?file_id=9845&type=bug
Issue History
2016-09-21 16:31caristuNew Issue
2016-09-21 16:31caristuAssigned To => platform
2016-09-21 16:31caristuModules => Core
2016-09-21 16:31caristuTriggers an Emergency Pack => No
2016-09-21 16:31caristuFile Added: testColumn.diff
2016-09-21 16:33caristuRelationship addedrelated to 0029270
2016-09-21 16:34caristuDescription Updatedbug_revision_view_page.php?rev_id=13147#r13147
2016-09-21 16:45caristuProposed Solution updated
2016-09-21 16:55caristuSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13149#r13149
2016-09-21 16:55caristuSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13150#r13150
2016-09-21 16:59caristuDescription Updatedbug_revision_view_page.php?rev_id=13151#r13151
2016-09-21 17:32caristuFile Deleted: testColumn.diff
2016-09-21 17:32caristuFile Added: testColumn.diff
2016-09-23 09:34alostaleNote Added: 0090185
2016-09-23 09:34alostaleStatusnew => closed
2016-09-23 09:34alostaleResolutionopen => invalid

Notes
(0090185)
alostale   
2016-09-23 09:34   
Working as designed: AD not null columns require of an on create default in order to populate values when they are not present in xml.