This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
1. Open some sample database in NetBeans DB node that contains foreign key constraints 2. Select all tables and delete them => Deleting typically fails, complaining that it can not delete some tables due to referential integrity constraints. Workaround is to delete the "higher" tables first, and then the "lower" tables. The fix should be if the IDE did that for you - figure out the table relationships and delete them in the right order.
Created attachment 148646 [details] proposed patch v1 The attached patch should cure the problem by hooking into the existing DbExtendedDelete class. Currently this class is mostly used to introduce a user confirmation dialog. This patch takes the selected table nodes, seperates them based on the connection they are from. For each connection the tables nodes are topologicaly sorted, so that the tables that depend on other tables are deleted first. As long as there are no cyclic dependencies this should solve the case. For the cyclic case this does not worsen the situation but reports it to the user. The user can than react to this.
The proposed patch was merged as: https://hg.netbeans.org/core-main/rev/a59e261f2fee in the next few days a nightly build will be created, that contains this change (a message is placed here then). My tests are positive and the idea is exactly as proposed (sort tables by dependency and delete in order). Please test that version. If you find it fixes your problem, please change the status of this bug to VERIFIED. Please note: This does not fix the issue of cyclic dependencies. These still need to be broken up manually.
Integrated into 'main-silver', will be available in build *201502090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/a59e261f2fee User: Matthias Blaesing <matthias42@netbeans.org> Log: #236580: Make table deletion more reliable by ordering deletes based on table dependencies
Product Version: NetBeans IDE Dev (Build 201502090001) Java: 1.8.0_25; Java HotSpot(TM) 64-Bit Server VM 25.25-b02 Runtime: Java(TM) SE Runtime Environment 1.8.0_25-b17 System: Linux version 3.13.0-24-generic running on amd64; UTF-8; en_US (nb) I tried steps described by Petr and it was possible to delete all tables without any warnings. Thanks for the fix Matthias!