Page MenuHomePhabricator

Unable to merge/delete blocked user
Closed, ResolvedPublic

Description

Author: NTICompass

Description:
I was trying to delete users who were in the block list and I got 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 "Database::update". Database returned error "1062: Duplicate entry '0' for key 'PRIMARY' (localhost)".

It seems it's trying to re-block the 'Anonymous' user, and it can't.


Version: unspecified
Severity: normal

Details

Reference
bz33414

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:00 AM
bzimport set Reference to bz33414.

What db are you using? Postgres?

@Eric:

please can you indicate why you have filed this bug as bug of the Component UserMerge ?

NTICompass wrote:

(In reply to comment #3)

@Eric:

please can you indicate why you have filed this bug as bug of the Component
UserMerge ?

Because it's about this extension => http://www.mediawiki.org/wiki/Extension:User_Merge_and_Delete

The issue was discussed here => http://www.mediawiki.org/wiki/Extension_talk:User_Merge_and_Delete#Database_Error

I figured I should report this as a bug. I was trying to delete users that were in the block list. When I try to delete a user (without merging), it merges it with "Anonymous" first. So when I delete a user in the block list, it blocks "Anonymous", so when I try to delete another user in the block list, I get an error because "Anonymous" is already in the block list (Duplicate entry '0' for key 'PRIMARY').

Ok. When I have time I will investigate, and perhaps repair this.

NTICompass wrote:

This is MediaWiki 1.16.4, if that matters. When I get time, I'll update to 1.18.0.

As a workaround, I deleted the row with PRIMARY KEY (ipb_id) 0 in wiki_ipblocks. This is the row, it's complaining about.

andrea.petrucci.1975 wrote:

same problem for me

MediaWiki 1.18.1
PHP 5.2.6-1+lenny9 (cgi-fcgi)
MySQL 5.0.51a-24+lenny4

UserMerge 1.6.31

mediawiki wrote:

I think I've found the/a cause of this bug:
I found the item in UserMerge_body.php: line 227 inserts ipb_id into the array of places where userid may be found in the database, even though ipb_id is not a user id but a primary key for its table. It should be changed to ipb_user. The original code, in context:
$idUpdateFields = array(

array('archive','ar_user'),
array('revision','rev_user'),
array('filearchive','fa_user'),
array('image','img_user'),
array('oldimage','oi_user'),
array('recentchanges','rc_user'),
array('logging','log_user'),
array('ipblocks', 'ipb_id'),
array('ipblocks', 'ipb_by'),
array('watchlist', 'wl_user'),

);

What the code should be:

$idUpdateFields = array(

array('archive','ar_user'),
array('revision','rev_user'),
array('filearchive','fa_user'),
array('image','img_user'),
array('oldimage','oi_user'),
array('recentchanges','rc_user'),
array('logging','log_user'),
array('ipblocks', 'ipb_user'),
array('ipblocks', 'ipb_by'),
array('watchlist', 'wl_user'),

);

  • Bug 35239 has been marked as a duplicate of this bug. ***

Change-Id: I166f0042b2445a06a63c6e3f70a28feae3603f13

Landed and backported to REL1_20 branch of the extension.