Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033659Openbravo ERPA. Platformpublic2016-08-09 08:292016-12-16 18:38
vmromanos 
inigosanchez 
normalmajoralways
closedopen 
5
 
3.0PR17Q1 
caristu
Core
No
0033659: DB consistency error with function index (Oracle only)
A new function is defined in the prescript-Oracle.sql.
This function is linked to a function index in any table.

The install source and update database processes are working fine, however the export database modifies the function index definition in Oracle only:

- <index-column name="functionBasedColumn" functionExpression="OBEQUALS(GENERATED_CREDIT, USED_CREDIT)"/>
+ <index-column name="functionBasedColumn" functionExpression="TRY_FULL_ORACLE.OBEQUALS(GENERATED_CREDIT,USED_CREDIT)"/>
1. Apply the attached patch in issue 0033581. It defines a function called OBEQUALS inside the prescripts* files, which is linked to a new index in FIN_PAYMENT table.
2. Run ant smartbuild -Dlocal=no (or install source). Verify it works fine
3. Set Core in development
4. Run ant export.database. Verify the index definition has changed, including now the bbdd.user defined in Openbravo.properties.
This creates a db consistency problem

Please note that this code is working fine for Postgresql (9.3)
No tags attached.
related to defect 0034209 closed platform DB consistency error with function index with 2 or more parameters separated by blank space or not 
blocks defect 00335813.0PR17Q2 closed vmromanos slow defaults retrieval in add payment 
Issue History
2016-08-09 08:29vmromanosNew Issue
2016-08-09 08:29vmromanosAssigned To => platform
2016-08-09 08:29vmromanosModules => Core
2016-08-09 08:29vmromanosTriggers an Emergency Pack => No
2016-08-09 08:29vmromanosRelationship addedblocks 0033581
2016-10-11 11:17inigosanchezStatusnew => scheduled
2016-10-11 11:17inigosanchezAssigned Toplatform => inigosanchez
2016-10-14 12:53inigosanchezRelationship addedrelated to 0034209
2016-10-21 12:38hgbotCheckin
2016-10-21 12:38hgbotNote Added: 0090759
2016-10-21 12:42hgbotCheckin
2016-10-21 12:42hgbotNote Added: 0090760
2016-10-21 12:42hgbotStatusscheduled => resolved
2016-10-21 12:42hgbotResolutionopen => fixed
2016-10-21 12:42hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/306b87decaa619f8cbf637a7af1290afe68eb521 [^]
2016-10-21 12:46inigosanchezReview Assigned To => caristu
2016-10-24 10:35caristuNote Added: 0090806
2016-10-24 10:35caristuStatusresolved => new
2016-10-24 10:35caristuResolutionfixed => open
2016-10-24 13:07inigosanchezStatusnew => scheduled
2016-10-25 11:35hgbotCheckin
2016-10-25 11:35hgbotNote Added: 0090857
2016-10-25 11:36hgbotCheckin
2016-10-25 11:36hgbotNote Added: 0090858
2016-10-25 11:36inigosanchezStatusscheduled => resolved
2016-10-25 12:47hgbotCheckin
2016-10-25 12:47hgbotNote Added: 0090860
2016-10-25 12:55caristuNote Added: 0090861
2016-10-25 12:55caristuStatusresolved => closed
2016-10-25 12:55caristuFixed in Version => 3.0PR17Q1
2016-10-25 15:16hgbotCheckin
2016-10-25 15:16hgbotNote Added: 0090866
2016-12-16 18:38hudsonbotCheckin
2016-12-16 18:38hudsonbotNote Added: 0092541
2016-12-16 18:38hudsonbotCheckin
2016-12-16 18:38hudsonbotNote Added: 0092554

Notes
(0090759)
hgbot   
2016-10-21 12:38   
Repository: erp/devel/dbsm-main
Changeset: af0309f5d016a3409494216292848bc0de405f24
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Fri Oct 21 12:37:37 2016 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/af0309f5d016a3409494216292848bc0de405f24 [^]

Related issue 33659: DB consistency error with function index (Oracle only)

When exporting database with a new custom function a db consistency error is
thrown in Oracle. The problem is that oracle add db user name at the beginning
of the indexExpression. For example, if "OBEQUALS(COL1)" is defined, export
database found this change "DB_USER.OBEQUALS(COL1)" and a db consistency error
is thrown. This problem was reproducible only in Oracle.

This problem has been solved removing db user name in the indexExpression in
OracleModelLoader.

Besides It has been created a test case for testing this
scenario in oracle and postgres too.

---
M src-test/src/org/openbravo/dbsm/test/model/ModelSuite.java
M src/org/apache/ddlutils/platform/oracle/OracleModelLoader.java
A src-test/model/excludeFilter/excludeIndexFunction.xml
A src-test/model/indexes/BASE_FUNCTION_INDEX_PRESCRIPT.xml
A src-test/src/org/openbravo/dbsm/test/model/CheckIndexFunctionInPrescripts.java
---
(0090760)
hgbot   
2016-10-21 12:42   
Repository: erp/devel/pi
Changeset: 306b87decaa619f8cbf637a7af1290afe68eb521
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Fri Oct 21 12:40:46 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/306b87decaa619f8cbf637a7af1290afe68eb521 [^]

Fixed issue 33659: DB consistency error with function index (Oracle only)

---
M src-db/database/lib/dbsourcemanager.jar
---
(0090806)
caristu   
2016-10-24 10:35   
Check code review at: https://docs.google.com/spreadsheets/d/18l2biKWeG6iGDIPqO6VuYQ_TtP_6YxyQU4KSrPvQlJ8/edit#gid=0 [^]
(0090857)
hgbot   
2016-10-25 11:35   
Repository: erp/devel/dbsm-main
Changeset: 854d69af1cbf9a5efa54b4db9cede2067837dc22
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Tue Oct 25 11:28:59 2016 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/854d69af1cbf9a5efa54b4db9cede2067837dc22 [^]

Related issue 33659: Codereview improvements.

---
M src-test/src/org/openbravo/dbsm/test/model/CheckIndexFunctionInPrescripts.java
M src/org/apache/ddlutils/platform/oracle/OracleModelLoader.java
---
(0090858)
hgbot   
2016-10-25 11:36   
Repository: erp/devel/pi
Changeset: c824d425f341595173fc89868ca605661827df4d
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Tue Oct 25 11:34:43 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/c824d425f341595173fc89868ca605661827df4d [^]

Related issue 33659: Codereview improvements

---
M src-db/database/lib/dbsourcemanager.jar
---
(0090860)
hgbot   
2016-10-25 12:47   
Repository: erp/devel/dbsm-main
Changeset: d3aa94edffe76ada3d0e21527f2cec6f0d507873
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Tue Oct 25 12:47:18 2016 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/d3aa94edffe76ada3d0e21527f2cec6f0d507873 [^]

Related issue 33659: Removed unnecesary comment.

---
M src/org/apache/ddlutils/platform/oracle/OracleModelLoader.java
---
(0090861)
caristu   
2016-10-25 12:55   
Code reviewed and tested with steps to reproduce: after exporting, the db owner is not included into the index functionExpression.
(0090866)
hgbot   
2016-10-25 15:16   
Repository: erp/devel/dbsm-main
Changeset: 6d64bb165ec3470d0ed0716a4e2f9c872ff65fa0
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Tue Oct 25 15:14:13 2016 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/6d64bb165ec3470d0ed0716a4e2f9c872ff65fa0 [^]

Related with issue 33659: fix test case in Postgres

---
M src-test/src/org/openbravo/dbsm/test/model/CheckIndexFunctionInPrescripts.java
---
(0092541)
hudsonbot   
2016-12-16 18:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/dc8bf00badd0 [^]
Maturity status: Test
(0092554)
hudsonbot   
2016-12-16 18:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/dc8bf00badd0 [^]
Maturity status: Test