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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0015862
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] Y. DBSourceManagermajoralways2011-02-03 16:452011-05-24 10:56
ReportergorkaionView Statuspublic 
Assigned Tomarvintm 
PriorityurgentResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revision0ad082cba101
ProjectionnoneETAnoneTarget Version3.0RC4
OSLinux 32 bitDatabaseOracleJava version1.5.0_15
OS VersionGentooDatabase version11gAnt version1.7.0
Product VersionpiSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0015862: Foreign keys to self table with delete on cascade constraint deletes valid records on update.database

DescriptionThe update.database validates that parent records on foreign keys with delete on cascade constraint exist. And in case that the foreign key refers to a record that doesn't exist it is deleted.

If the foreign key refers to the same table this validation is not properly done and all records with the foreign key filled are deleted.
Steps To ReproduceThis case exists on the obkmo_widget_instance table where the copied_from column is a foreign key to the same table.

1- Check the number of records on this table where the copied_from column is not null.
2- Execute the update.database task.
3- Before login in to the application again check that only records with copied_from null remain.
Proposed SolutionThe update.database generates the following delete statement

DELETE FROM OBKMO_WIDGET_INSTANCE WHERE NOT EXISTS (SELECT COPIED_FROM FROM OBKMO_WIDGET_INSTANCE WHERE OBKMO_WIDGET_INSTANCE.COPIED_FROM=OBKMO_WIDGET_INSTANCE.OBKMO_WIDGET_INSTANCE_ID) AND OBKMO_WIDGET_INSTANCE.COPIED_FROM IS NOT NULL

This statement should use an alias on one of the tables.
TagsclosingMay2011
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0034046)
marvintm (developer)
2011-02-03 19:36

This problem only happens on Oracle, because dbsourcemanager uses different syntax for both databases.
(0034047)
hgbot (developer)
2011-02-03 19:36

Repository: erp/devel/dbsm-main
Changeset: 04cfdf3a3bd15922feadfa8570c4f1e0b3a59b6f
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Thu Feb 03 19:36:30 2011 +0100
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/04cfdf3a3bd15922feadfa8570c4f1e0b3a59b6f [^]

Fixed issue 15862. Use an alias when removing invalid rows

---
M src/org/apache/ddlutils/platform/SqlBuilder.java
M src/org/openbravo/ddlutils/task/ExportDatabase.java
---
(0034048)
hgbot (developer)
2011-02-03 19:38

Repository: erp/devel/pi
Changeset: 0ad082cba10156f9e881e96048caaf715945adab
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Thu Feb 03 19:37:54 2011 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/0ad082cba10156f9e881e96048caaf715945adab [^]

Fixed issue 15862. Use an alias when removing invalid rows

---
M src-db/database/lib/dbsourcemanager.jar
---
(0034059)
gorkaion (developer)
2011-02-04 14:57

retested on oracle. working fine.

- Issue History
Date Modified Username Field Change
2011-02-03 16:45 gorkaion New Issue
2011-02-03 16:45 gorkaion Assigned To => marvintm
2011-02-03 16:45 gorkaion Modules => Core
2011-02-03 19:36 marvintm Note Added: 0034046
2011-02-03 19:36 hgbot Checkin
2011-02-03 19:36 hgbot Note Added: 0034047
2011-02-03 19:36 hgbot Status new => resolved
2011-02-03 19:36 hgbot Resolution open => fixed
2011-02-03 19:36 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/dbsm-main/rev/04cfdf3a3bd15922feadfa8570c4f1e0b3a59b6f [^]
2011-02-03 19:38 hgbot Checkin
2011-02-03 19:38 hgbot Note Added: 0034048
2011-02-03 19:38 hgbot Fixed in SCM revision http://code.openbravo.com/erp/devel/dbsm-main/rev/04cfdf3a3bd15922feadfa8570c4f1e0b3a59b6f [^] => http://code.openbravo.com/erp/devel/pi/rev/0ad082cba10156f9e881e96048caaf715945adab [^]
2011-02-04 14:57 gorkaion Note Added: 0034059
2011-05-24 10:08 dalsasua Tag Attached: closingMay2011
2011-05-24 10:56 dalsasua Status resolved => closed


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker