Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0014060Openbravo ERPY. DBSourceManagerpublic2010-07-27 10:572010-08-11 00:00
marvintm 
marvintm 
urgentmajorhave not tried
closedfixed 
5
 
2.50MP21 
Core
No
0014060: update.database will fail when recreating the table if a column had an illegal datatype
Right now, if a column has an illegal datatype, the export.database will fail with a clear error. However, this was not the case in previous versions of dbsourcemanager. This means that there could be modules out there with illegal datatypes in their physical columns (usually identified by being of type "VARCHAR" with length 0).

Update.database will attempt to create the table with that incorrect type (VARCHAR(0)), and will of course fail. This could lead to data loss.
In an old version of Openbravo, export a table with a column of type "INTEGER" in PostgreSQL. Verify that it is indeed exported with type "VARCHAR 0". Then, try to do update.database. The table creation will fail, and data could be lost.
Update.database will do a validation while initializing the model. If it finds out an illegal type in the XML files, it will stop without doing anything to the database.
No tags attached.
Issue History
2010-07-27 10:57marvintmNew Issue
2010-07-27 10:57marvintmAssigned To => marvintm
2010-07-27 17:35hgbotCheckin
2010-07-27 17:35hgbotNote Added: 0029615
2010-07-27 17:35hgbotStatusnew => resolved
2010-07-27 17:35hgbotResolutionopen => fixed
2010-07-27 17:35hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/c1df94e38a27320896984f63a13fe99ae12428e7 [^]
2010-07-27 18:10hgbotCheckin
2010-07-27 18:10hgbotNote Added: 0029618
2010-07-27 18:10hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/c1df94e38a27320896984f63a13fe99ae12428e7 [^] => http://code.openbravo.com/erp/devel/dbsm-main/rev/3324bf350dfed9decea6c9ee76a000ca9b6b2033 [^]
2010-07-27 23:48hudsonbotCheckin
2010-07-27 23:48hudsonbotNote Added: 0029623
2010-08-10 16:15alostaleStatusresolved => closed
2010-08-10 16:15alostaleFixed in Version => 2.50MP21
2010-08-11 00:00anonymoussf_bug_id0 => 3042776

Notes
(0029615)
hgbot   
2010-07-27 17:35   
Repository: erp/devel/pi
Changeset: c1df94e38a27320896984f63a13fe99ae12428e7
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Tue Jul 27 17:32:06 2010 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/c1df94e38a27320896984f63a13fe99ae12428e7 [^]

Fixed issue 14060. Changed handling of illegal datatypes
Now, both update.database and update.database.mod will fail early if an illegal datatype is detected either in the database or in the XML files, therefore minimizing the risk of data loss. Before, the change was attempted, usually ending in failure, and in some cases, with loss of data, due to failed recreation of the table.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0029618)
hgbot   
2010-07-27 18:10   
Repository: erp/devel/dbsm-main
Changeset: 3324bf350dfed9decea6c9ee76a000ca9b6b2033
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Tue Jul 27 17:26:16 2010 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/3324bf350dfed9decea6c9ee76a000ca9b6b2033 [^]

Fixed issue 14060. Changed handling of illegal datatypes
Now, both update.database and update.database.mod will fail early if an illegal datatype is detected either in the database or in the XML files, therefore minimizing the risk of data loss. Before, the change was attempted, usually ending in failure, and in some cases, with loss of data, due to failed recreation of the table.

---
M src/org/apache/ddlutils/model/Database.java
M src/org/openbravo/ddlutils/task/AlterDatabaseDataAll.java
M src/org/openbravo/ddlutils/task/AlterDatabaseDataMod.java
---
(0029623)
hudsonbot   
2010-07-27 23:48   
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/c1df94e38a27 [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/5cf2bb15d5b1 [^]
Tests: http://builds.openbravo.com/view/int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.17927.obx [^]