Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036933Openbravo ERPY. DBSourceManagerpublic2017-09-20 18:572017-09-25 12:45
malsasua 
AugustoMauch 
immediatemajoralways
closedfixed 
5
 
3.0PR17Q2.43.0PR17Q2.4 
alostale
Core
Production - Confirmed Stable
2017-01-11
3.0PR17Q2
http://code.openbravo.com/erp/devel/pi/rev/47c768943f70d1c674cb0a2701faf29edde3da84 [^]
No
0036933: It is not possible to change the size of columns if the column is used in a view
when a column is used in a view, and the column size is changed, the update.database process returns one error:
     [java] 113277 WARN - SQL Command failed with: ERROR: cannot alter type of a column used by a view or rule
     [java] Detail: rule _RETURN on view c_invoice_v2 depends on column "poreference"
     [java] 113285 WARN - -- END
     [java] ALTER TABLE C_INVOICE ALTER COLUMN POREFERENCE TYPE VARCHAR(255)
. in xml file (src-db/database/model/tables/C_INVOICE.xml), change the size of column "POREFERENCE" to 255 in c_invoice table
. execute:
ant update.database
No tags attached.
blocks defect 0036908 closed AugustoMauch It is not possible to change the size of columns if the column is used in a view 
Issue History
2017-09-25 09:41AugustoMauchTypedefect => backport
2017-09-25 09:41AugustoMauchTarget Version => 3.0PR17Q4.1
2017-09-25 10:41AugustoMauchTarget Version3.0PR17Q4.1 => 3.0PR17Q2.4
2017-09-25 10:57hgbotCheckin
2017-09-25 10:57hgbotNote Added: 0099518
2017-09-25 10:57hgbotStatusscheduled => resolved
2017-09-25 10:57hgbotResolutionopen => fixed
2017-09-25 10:57hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/dbsm-main/rev/7cdd957ca8790f1c9bb971e66c40b9f38a842b7d [^] => http://code.openbravo.com/erp/backports/3.0PR17Q2.4/rev/f7d032aa59828520dbd057236261c0bf65eeb8fd [^]
2017-09-25 12:45alostaleNote Added: 0099534
2017-09-25 12:45alostaleStatusresolved => closed
2017-09-25 12:45alostaleFixed in Version => 3.0PR17Q2.4

Notes
(0099518)
hgbot   
2017-09-25 10:57   
Repository: erp/backports/3.0PR17Q2.4
Changeset: f7d032aa59828520dbd057236261c0bf65eeb8fd
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Mon Sep 25 10:24:56 2017 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR17Q2.4/rev/f7d032aa59828520dbd057236261c0bf65eeb8fd [^]

Fixes bug 36933:Updating the column length on table referenced by a view works

There was a problem when a the column length of a table (T) referenced by a view (V) was updated, if that view was referenced by another view (V2).

In the step to update the model, the following steps were done in single batch:
- The views are dropped (forced = true)
- The model is updated (forced = false)
- The views are recreated

What happened is that the view V1 could not be dropped because V2 referenced it (and drop on cascade was not used). Then the batch failed, and only those
commands with forced=true were recreated, so the model was not updated.

To fix this, now the views are dropped in a different batch than the one used to update the model. There is an API change, since before this change this step
was enough to do the whole update of the model:

getSqlBuilder().alterDatabase(currentModel, desiredModel, params);

And now this it is required to call and evalue the following command:

getSqlBuilder().prepareDatabaseForAlter(currentModel, desiredModel, params, changes);

This has been changed in all Openbravo occurrences, and no occurrences outside Openbravo have been found.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0099534)
alostale   
2017-09-25 12:45   
reviewed + tested