uid_linker table sometimes contains duplicate values

Liam McDermott - June 26, 2009 - 06:02
Project:vBulletin to Drupal
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Indexing the uid_linker table is failing sometimes due to duplicate values in unique columns. For example:

    * user warning: Duplicate entry 'John Smith' for key 1 query: ALTER TABLE uid_linker ADD CONSTRAINT uid_linker_name PRIMARY KEY (name), ADD CONSTRAINT uid_linker_drupal_uid UNIQUE (drupal_uid), ADD CONSTRAINT uid_liner_vb_uid UNIQUE (vb_uid), ADD CONSTRAINT uid_liner_vb_uid_orig UNIQUE (vb_uid_orig) in /home/folder/public_html/3.0beta/sites/all/modules/vbtodrupal/vbtodrupal.module on line 1273.
    * user warning: Duplicate entry '1004112-1000002' for key 1 query: UPDATE users_roles ur, uid_linker ul SET uid = drupal_uid WHERE ur.uid = ul.vb_uid in /home/folder/public_html/3.0beta/sites/all/modules/vbtodrupal/vbtodrupal.module on line 1310.
    * user warning: Duplicate entry '1004112-22' for key 1 query: UPDATE profile_values pv, uid_linker ul SET uid = drupal_uid WHERE pv.uid = ul.vb_uid in /home/folder/public_html/3.0beta/sites/all/modules/vbtodrupal/vbtodrupal.module on line 1314.

It's possible that the temporary table isn't being deleted between import attempts.

#1

smk-ka - November 27, 2009 - 16:07

Nope, temporary tables are automatically destroyed after the request (or, technically correct: the database connection) ends. ;)

However, vBulletin treats usernames case-sensitive, i.e. 'John Smith' and 'john smith' may both be registered at your site (and likely are, hence the error message). It seems like the ADD PRIMARY KEY (name) is the real culprit here, but I am not sure why. It looks like MySQL treats primary keys always as case-insensitive, but I can't find a reference in the MySQL manual to prove this.

 
 

Drupal is a registered trademark of Dries Buytaert.