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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0045728
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] Y. DBSourceManagerminorhave not tried2021-01-13 17:342021-01-13 17:34
ReportershuehnerView Statuspublic 
Assigned Toplatform 
PrioritynormalResolutionopenFixed in Version
StatusnewFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
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

0045728: update.database fails when renaming the primaryKey of a table definition in the xml file

DescriptionDatabase element names should follow module naming convention and in case of fixing old modules sometime names will be 'fixed' to comply with them.

Renaming the primaryKey name of a table in any src-db/datbase/tables/<TABLENAME>.xml file makes update.database fails with SQL error trying to apply those.

Scenarios below tested with master >21Q1 and pg10 and oracle19

2 specific sub-problems
a.)
On postgresql:
     [java] ALTER TABLE AD_TABLE
     [java] ADD CONSTRAINT AD_TABLE_KEY_NEW PRIMARY KEY (AD_TABLE_ID)

Happens on any rename of the primary key.
Apparently logic does not support this as apparently it is missing to drop the old pk constraint first ?

b.) oracle and pk has incoming fk
     [java] 94900 [main] WARN org.apache.ddlutils.platform.OracleStandardBatchEvaluator - SQL Command failed with: ORA-02273: this unique/primary key is referenced by some foreign keys
     [java]
     [java] 94900 [main] WARN org.apache.ddlutils.platform.OracleStandardBatchEvaluator - ALTER TABLE AD_TABLE
     [java] DROP PRIMARY KEY DROP INDEX
     [java] 94908 [main] WARN org.apache.ddlutils.platform.OracleStandardBatchEvaluator - SQL Command failed with: ORA-02260: table can have only one primary key
     [java]
     [java] 94909 [main] WARN org.apache.ddlutils.platform.OracleStandardBatchEvaluator - -- END
     [java] ALTER TABLE AD_TABLE
     [java] ADD CONSTRAINT AD_TABLE_KEY_NEW PRIMARY KEY (AD_TABLE_ID)

drop index fails as there is a foreign key from other table still pointing to the pk
Then 2nd error is same as in case a.) above

c.) Oracle when there is no incoming foreign key

In this case the renaming works without a problem as can be tested editing primaryKey for example for the AD_SESSION_USAGE_AUDIT table
Steps To Reproduceinstall.source of unmodified sources
edit table xml file for the tables seen in the cases above and rename the value of primaryKey (2nd line in xml file) to a different name
run update.database to apply the changed xml file
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2021-01-13 17:34 shuehner New Issue
2021-01-13 17:34 shuehner Assigned To => platform
2021-01-13 17:34 shuehner Modules => Core
2021-01-13 17:34 shuehner Triggers an Emergency Pack => No


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker