Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0028143Openbravo ERPA. Platformpublic2014-11-11 17:362015-02-04 20:34
egoitz 
alostale 
normalmajoralways
closedfixed 
5
 
3.0PR15Q1 
AugustoMauch
Core
No
0028143: The database sequences are exported to xml files including also the next value
The database sequences are exported to xml files including also the next value.
Define a database sequence and after use it some times export it.
See that the next value is also exported.
No tags attached.
related to defect 0028677 new marvintm Retail Modules unused sequences in webPOS module 
related to design defect 0029800 closed AugustoMauch Openbravo ERP Allow excluding sequences from model 
related to defect 0036916 closed caristu Openbravo ERP PG10: update.database fails if there are DB sequences 
Issue History
2014-11-11 17:36egoitzNew Issue
2014-11-11 17:36egoitzAssigned To => AugustoMauch
2014-11-11 17:36egoitzModules => Core
2014-11-11 17:36egoitzTriggers an Emergency Pack => No
2015-01-26 08:57alostaleRelationship addedrelated to 0028677
2015-01-26 09:01alostaleAssigned ToAugustoMauch => alostale
2015-01-26 09:30alostaleNote Added: 0073762
2015-01-26 09:42alostaleNote Edited: 0073762bug_revision_view_page.php?bugnote_id=0073762#r7530
2015-01-26 14:14hgbotCheckin
2015-01-26 14:14hgbotNote Added: 0073778
2015-01-26 14:14hgbotStatusnew => resolved
2015-01-26 14:14hgbotResolutionopen => fixed
2015-01-26 14:14hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/6a58049e36b4a93eddbdc395bedb23e5581ba0b2 [^]
2015-01-26 14:16alostaleNote Added: 0073780
2015-01-26 14:17alostaleReview Assigned To => AugustoMauch
2015-01-26 16:35AugustoMauchNote Added: 0073784
2015-01-26 16:35AugustoMauchStatusresolved => closed
2015-01-26 16:35AugustoMauchFixed in Version => 3.0PR15Q1
2015-02-04 20:34hudsonbotCheckin
2015-02-04 20:34hudsonbotNote Added: 0074183
2015-05-06 12:56egoitzRelationship addedrelated to 0029800
2017-09-21 14:05alostaleRelationship addedrelated to 0036916

Notes
(0073762)
alostale   
2015-01-26 09:30   
(edited on: 2015-01-26 09:42)
There are several design defect in the sequences support by dbsm:

== Oracle ==

-Current sequence's value is exported to xml as starting value. Resulting in xml changes whenever the instance has been used in dev environment
-When updating DB current value in DB is compared with starting value in xml, resulting in the sequence being recreated in each update.database
-Any change in the sequence results in the sequence being completely recreated by update.database.

== PostgreSQL ==

-Sequence's start and increment are always set to 1. This makes not possible to define in a postgresql development environment a sequence with other values.
-If the xml files contains other values for start or increment, a change is always detected recreating the sequence. This recreation occurs in all subsequent update.database.

== Solution ==

For both, Oracle and PostgreSQL.
-Export to xml sequences correctly taking into account start and increment values, but not exporting current value.
-Do not recreate sequences for any model change. When there are changes in start or increment, the sequence will be altered keeping current sequence number.

== Test cases ==

Defined in https://testlink.openbravo.com/testlink/linkto.php?tprojectPrefix=Communit&item=testcase&id=Communit-8030 [^]

(0073778)
hgbot   
2015-01-26 14:14   
Repository: erp/devel/pi
Changeset: 6a58049e36b4a93eddbdc395bedb23e5581ba0b2
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Jan 26 14:13:56 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/6a58049e36b4a93eddbdc395bedb23e5581ba0b2 [^]

fixed issue 28143: proper support for DB sequences

  Several fixes for supporting DB sequences both in Oracle and PostgreSQL.

   -Oracle min number is properly obtained instead of current value
   -PG min and increment are properly obtained instead of hardcoding them to 1
   -Both changes in min and increment do not cause sequence recreation

---
M src-db/database/lib/dbsourcemanager.jar
---
(0073780)
alostale   
2015-01-26 14:16   
Fixed in dbsm repo by changesets:

https://code.openbravo.com/erp/devel/dbsm-main/rev/f64ac3268016 [^]
https://code.openbravo.com/erp/devel/dbsm-main/rev/6fe5f1388455 [^]
https://code.openbravo.com/erp/devel/dbsm-main/rev/ec86449b7d14 [^]
(0073784)
AugustoMauch   
2015-01-26 16:35   
Code reviewed and verified in pi@6a58049e36b4
(0074183)
hudsonbot   
2015-02-04 20:34   
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/f36c91d0ad63 [^]
Maturity status: Test