Openbravo Issue Tracking System - Openbravo ERP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0015862 | Openbravo ERP | Y. DBSourceManager | public | 2011-02-03 16:45 | 2011-05-24 10:56 |
|
Reporter | gorkaion | |
Assigned To | marvintm | |
Priority | urgent | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | | OS | 20 | OS Version | Gentoo |
Product Version | pi | |
Target Version | 3.0RC4 | Fixed in Version | | |
Merge Request Status | |
Review Assigned To | |
OBNetwork customer | |
Web browser | |
Modules | Core |
Support ticket | |
Regression level | |
Regression date | |
Regression introduced in release | |
Regression introduced by commit | |
Triggers an Emergency Pack | No |
|
Summary | 0015862: Foreign keys to self table with delete on cascade constraint deletes valid records on update.database |
Description | The 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 Reproduce | This 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 Solution | The 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. |
Additional Information | |
Tags | closingMay2011 |
Relationships | |
Attached Files | |
|
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 |
Notes |
|
|
This problem only happens on Oracle, because dbsourcemanager uses different syntax for both databases. |
|
|
(0034047)
|
hgbot
|
2011-02-03 19:36
|
|
|
|
(0034048)
|
hgbot
|
2011-02-03 19:38
|
|
|
|
|
retested on oracle. working fine. |
|