Last modified: 2012-12-01 09:09:09 UTC
I get an SQL error that results in a fatal error when merging one blocked user into another (2 vandals in this case, one is my "Vandal deposit" and the other has an offensive username). The SQL error is generated because blocks table can't have 2 entries for the same user-id (conflicts with the unique pair requirement on the schema). Not sure what the correct solution is, but it should atleast not crash the merge and throw an exception. Suggesting to perhaps query the user with a question ("( ) Preserve the origin user block / ( ) Preserve the target user block"). Or don't allow such moves and require them one of them to be unblocked before hand (but that creates an extra log action that doesn't make sense (unblocking the vandal)). I think dropping the block on the origin user makes the most sense (when both are blocked), if only one of them is blocked, then there is no problem. After the merge the target user is blocked either way.
Possibly related: * (bug 33414) Cannot delete users in block list
I temporarily circumvented it (depending on the situation) by either * removing the rows for the old user from the block table manually via MySQL * or by commenting out the 2 block-table arrays in the php code that managest the query, leaving orphaned rows in the database, but at least the merge can continue.
I think I may be experiencing this bug too. Since I upgrade to MediaWiki 1.18.3, I've been unable to merge users. Any attempt results in this error: A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: (SQL query hidden) from within function "DatabaseBase::update". Database returned error "1062: Duplicate entry '2' for key 'PRIMARY' (db.camera-wiki.org)". Is there a fix in the works for this yet or is merge-and-delete just not compatible with 1.18+?
(cc Roan) Roan catched the likely cause of this in the code. The extension is trying to update the `ipb_id` column of the `ipblocks` table, which is wrong. Because that's the primary key as opposed to the user id. It should instead update `ipb_user`.
I can tentatively confirm that workaround in Comment 4 works. What I did was edit line 227 of UserMerge_body.php from this: array('ipblocks', 'ipb_id'), to this: array('ipblocks', 'ipb_user'), After doing that I tried to merge a user with the "delete old user" option checked. No error message this time. It appears to have worked correctly.
@ Steevithak Thanks for reporting. I'll try to replicate the bug and solution and then apply a bug fix (commit via gerrit to our git repo. I hate the new workflow, but it's the only one we have at the moment).
bump, still happening as of 1.20.1. I confirm that replacing ipb_id with ipb_user fixes it.
*** This bug has been marked as a duplicate of bug 33414 ***