Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0049897
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] Y. DBSourceManagermajorhave not tried2022-07-28 13:192022-11-18 09:23
ReportershuehnerView Statuspublic 
Assigned Toalostale 
PrioritynormalResolutionfixedFixed in VersionPR22Q4
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget VersionPR22Q4
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0049897: Add missing support for referencing other columns in onCreateDefault during importsampledata

DescriptiononCreateDefault support sql-expressions on top of just fixed constant literals.

That is fully implemented during update.database.

However this logic used during import.sampledata currently only supports constant literals.

We should add support for at least one common case which is referencing another column of the same table (to copy the data from).

Example snippet for a module adding such a column to M_LOCATOR table.

      <column name="NEW_COLUMN_CODE" primaryKey="false" required="true" type="NVARCHAR" size="40" autoIncrement="false">
        <default/>
        <onCreateDefault><![CDATA[VALUE]]></onCreateDefault>
      </column>

Steps To ReproduceAdd a new required column to an existing table with definition shown above (i.e. table M_LOCATOR)
Do NOT modify sampledata to contain data for the new column.
Run install.source and observe not-null constraint violation for the new column.
Proposed SolutionAdd code to existing logic supporting 'onCreateDefault for not null column during import.sampledata' to detect:
- Referencing another column on the same table
- Replace column reference by 'value' of that other column planned to be inserted.

TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0046647 closedalostale Neither onCreateDefault nor default values are used when inserting sampledata 
related to feature request 0050951 closedcaristu onCreateDefault not working for non mandatory columns referencing same table 

-  Notes
(0139668)
shuehner (administrator)
2022-07-28 13:20

Adding short due-date as discussed between ALO/SHU
(0139678)
hgbot (developer)
2022-07-28 14:27

Merge Request created: https://gitlab.com/openbravo/product/dbsm/-/merge_requests/33 [^]
(0140062)
hgbot (developer)
2022-08-11 13:09

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/679 [^]
(0140063)
hgbot (developer)
2022-08-11 13:10

Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/679 [^]
(0140064)
hgbot (developer)
2022-08-11 13:10

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 594166468e5cd20dcc0b116a8cca822ec1bdc967
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 11-08-2022 13:08:53
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/594166468e5cd20dcc0b116a8cca822ec1bdc967 [^]

Fixes ISSUE-49897: import sample data fails with OCD referencing a column

---
M src-db/database/lib/dbsourcemanager.jar
---
(0140065)
hgbot (developer)
2022-08-11 13:10

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/dbsm [^]
Changeset: 1984dc6f1bcbd78eb33e445ce1518cd763872d33
Author: Asier Lostalé <asier.lostale@openbravo.com>
Date: 28-07-2022 14:23:03
URL: https://gitlab.com/openbravo/product/dbsm/-/commit/1984dc6f1bcbd78eb33e445ce1518cd763872d33 [^]

fixes BUG-49897: import sample data fails with OCD referencing a column

If a mandatory column has an onCreateDefault consisting on an expression
that simply references another column in that same table and sampledata
with no value for that column is applied, it fails because only literal
onCreateDefault are applied in this case.

The logic has been extended to cover this case (not including
recursivity), now the value of the referenced column is applied.

---
A src-test/data/sampledata/REFERENCE_CREATEDEFAULT.xml
A src-test/model/sampledata/SAMPLE_DATA_MODEL2.xml
M src-test/src/org/openbravo/dbsm/test/sampledata/ImportSampleData.java
M src/org/apache/ddlutils/io/DataToDatabaseSink.java
M src/org/apache/ddlutils/model/Column.java
---
(0140066)
hgbot (developer)
2022-08-11 13:10

Merge request merged: https://gitlab.com/openbravo/product/dbsm/-/merge_requests/33 [^]

- Issue History
Date Modified Username Field Change
2022-07-28 13:19 shuehner New Issue
2022-07-28 13:19 shuehner Assigned To => Triage Platform Base
2022-07-28 13:19 shuehner Modules => Core
2022-07-28 13:19 shuehner Triggers an Emergency Pack => No
2022-07-28 13:20 shuehner Note Added: 0139668
2022-07-28 14:27 hgbot Note Added: 0139678
2022-08-01 09:03 AugustoMauch Assigned To Triage Platform Base => alostale
2022-08-01 09:03 AugustoMauch Status new => scheduled
2022-08-11 13:09 hgbot Note Added: 0140062
2022-08-11 13:10 hgbot Resolution open => fixed
2022-08-11 13:10 hgbot Status scheduled => closed
2022-08-11 13:10 hgbot Note Added: 0140063
2022-08-11 13:10 hgbot Fixed in Version => PR22Q4
2022-08-11 13:10 hgbot Note Added: 0140064
2022-08-11 13:10 hgbot Note Added: 0140065
2022-08-11 13:10 hgbot Note Added: 0140066
2022-11-18 09:23 caristu Relationship added related to 0046647
2022-11-18 13:41 caristu Relationship added related to 0050951


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker