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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0006770
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformmajoralways2009-01-02 18:192009-04-21 11:09
ReporteriperdomoView Statuspublic 
Assigned Tomtaal 
PriorityhighResolutionfixedFixed in Version
StatusclosedFix in branchpiFixed in SCM revision11666
ProjectionnoneETAnoneTarget Versionpi
OSLinux 32 bitDatabaseOracleJava version1.5.0_15
OS Version2.6.23-gentoo-r9Database versionXE - 10.2.0.1.0Ant version1.7.0
Product VersionpiSCM revision11637 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0006770: create.database fails when default role is different than System Administrator

Descriptioncreate.database fails when the default role of Openbravo user is not System Administrator (0)
Steps To ReproduceWith a running Openbravo instance do:
* Change Openbravo role to Openbravo Admin and mark as default
* Mark core module as 'In Development'
* ant export.database
* ant create.database

Attached you'll find the create.database log
TagsNo tags attached.
Attached Fileslog file icon create.database.log [^] (1,944 bytes) 2009-01-02 18:19

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0011903)
mtaal (manager)
2009-01-04 15:21

Hi Ivan,
When I check the attached log it says this:
/home/iperdomo/workspaces/trunk/openbravo/src-db/database/build-create.xml:69: org.apache.ddlutils.DatabaseOperationException: Error while enabling foreign key

I do not see a direct relation between the subject of this issue and the error message in the log.
Can you give some more info?

gr. Martin
(0011904)
iperdomo (reporter)
2009-01-04 20:11

Hi Martin,

If the AD_USER.xml the default role is different than 0, the create.database fails. Can you try to repeat the steps to reproduce the error?

I don't know direct relation between the default role and the 'enabling foreign key' error message, I just know that fails.

Best Regards,

Iván
(0011908)
mtaal (manager)
2009-01-05 10:36

After doing ant -debug create.database, the following stacktrace showed up:
[importdata] ALTER TABLE AD_USER
[importdata] ADD CONSTRAINT ADCLIENT_ADUSERDEFAULT FOREIGN KEY (DEFAULT_AD_CLIENT_ID) REFERENCES AD_CLIENT (AD_CLIENT_ID)
[importdata] org.postgresql.util.PSQLException: ERROR: insert or update on table "ad_user" violates foreign key constraint "adclient_aduserdefault"
[importdata] Detail: Key (default_ad_client_id)=(1000000) is not present in table "ad_client".
[importdata] at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
[importdata] at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
[importdata] at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
[importdata] at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
[importdata] at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337)
[importdata] at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:329)
[importdata] at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:261)
[importdata] at org.apache.ddlutils.platform.PlatformImplBase.evaluateBatch(PlatformImplBase.java:341)
[importdata] at org.apache.ddlutils.platform.postgresql.PostgreSqlPlatform.enableAllFK(PostgreSqlPlatform.java:304)
(0011909)
mtaal (manager)
2009-01-05 10:42

The reason for the exception is the following:
- user 100 is part of sourcedata (is defined like that in the ADRD dataset
- client 1000000 is part of masterdata
- user 100 refers directly to client 1000000
- however because source data is inserted before masterdata a fk constraint violation occurs.

A similar issue arose earlier with a default language reference from the user to the language table.

A possible solution could be to export/import the 100 user as part of masterdata instead of sourcedata. But as the 100 user is explicitly part of the sourcedata there maybe unknown (for me) reasons to have the 100 user in source data.

gr. Martin
(0011910)
mtaal (manager)
2009-01-05 10:43

Hi Ismael,
See the notes, above can you comment and give your opinion on this issue?

Tx!

gr. Martin
(0011918)
iciordia (manager)
2009-01-05 16:05

Remove default columns from source.data dataset, since they can be modified by users and they are the owners of this info.

Ismael
(0011928)
svnbot (reporter)
2009-01-06 14:11

Repository: openbravo
Revision: 11666
Author: mtaal
Date: 2009-01-06 14:11:56 +0100 (Tue, 06 Jan 2009)

fixes issue 6770, create.database fails when default role is different than System Administrator
Description, fix is to not export the columns of ad_user which refer to masterdata, this is done by changing the ADRD dataset and the AD_USER DataSetTable.

---
U trunk/src-db/database/sourcedata/AD_DATASET.xml
U trunk/src-db/database/sourcedata/AD_DATASET_COLUMN.xml
U trunk/src-db/database/sourcedata/AD_DATASET_TABLE.xml
U trunk/src-db/database/sourcedata/AD_MODULE.xml
U trunk/src-db/database/sourcedata/AD_USER.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=11666&sc=1 [^]

- Issue History
Date Modified Username Field Change
2009-01-02 18:19 iperdomo New Issue
2009-01-02 18:19 iperdomo Assigned To => marvintm
2009-01-02 18:19 iperdomo sf_bug_id 0 => 2482651
2009-01-02 18:19 iperdomo File Added: create.database.log
2009-01-02 18:19 iperdomo Regression testing => No
2009-01-04 12:25 iciordia Assigned To marvintm => mtaal
2009-01-04 15:21 mtaal Note Added: 0011903
2009-01-04 20:11 iperdomo Note Added: 0011904
2009-01-05 10:36 mtaal Note Added: 0011908
2009-01-05 10:42 mtaal Note Added: 0011909
2009-01-05 10:43 mtaal Note Added: 0011910
2009-01-05 10:43 mtaal Assigned To mtaal => iciordia
2009-01-05 10:43 mtaal Status new => feedback
2009-01-05 16:05 iciordia Assigned To iciordia => mtaal
2009-01-05 16:05 iciordia Status feedback => scheduled
2009-01-05 16:05 iciordia Note Added: 0011918
2009-01-05 16:05 iciordia fix_in_branch => trunk
2009-01-06 14:11 svnbot Checkin
2009-01-06 14:11 svnbot Note Added: 0011928
2009-01-06 14:11 svnbot Status scheduled => resolved
2009-01-06 14:11 svnbot Resolution open => fixed
2009-01-06 14:11 svnbot svn_revision => 11666
2009-04-21 11:09 psarobe Status resolved => closed


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker