cmdr wrote: ↑
Wed Jul 17, 2019 12:38 pm
ACP → Users and Groups → entered username → opens "User administration" → panel "Basic tools" → Delete all posts.
The resulting page showed an SQL error. I believe this function executes several SQL commands in a row. First, it deletes all posts, then it does some insert/update in another table (but since I didn't write the SQL error down, I don't know which).
As you may imagine, there are a lot of updates to choose from. (Initiated by delete_posts() in /includes/functions_admin.php.) Just in the core, I stopped counting after fourteen different table deletes and updates, and settled on "a lot."
In addition to following the other good advice thus far, if it had happened to me, one thing I would be trying is to create a new test user, give them at least one post, at least one attachment, and create at least one notification subscription to this user's post which is about to become deleted. Then try and delete that test user's posts, and see if you can repeat the duplicate key error.
There may be other conditions necessary to duplicate the issue that we simply don't know, so the issue may or may not duplicate successfully. e.g. Conditions which are unique to other extensions which are also installed, etc. But duplicating it would be the "easiest" way to identify which action and table had been involved in the error.
Still, even assuming you can identify and resolve that failure 100%, that only prevents future recurrence of the problem. It still doesn't help recover from the "previous partial delete completion" state that the board is currently in. Like warmweer suggested, a better understanding of "which table and error occurred" as well as "what exact problems you're facing now" is probably needed in order for anyone to suggest a path for recovery that doesn't involve restoring the database to a known-good starting point.