UPDATE sql requests in postgresql don't allow LIMIT keyword cf doc, leading to those query failing :
UPDATE profile_values SET value = 'Foo' WHERE fid = 7 AND uid = 8 LIMIT 1

fid & uid being primary keys anyway, LIMIT 1 is not needed.

Patch to fix it inline, works for me :

--- supported/profile.inc.orig  2009-09-18 12:53:23.000000000 +0000
+++ supported/profile.inc       2009-09-18 12:53:49.000000000 +0000
@@ -43,7 +43,7 @@
   
   // data column in the user table needs to be updated
   if ($data != $old_data) {   
-    db_query("UPDATE {users} SET data = '%s' WHERE uid = %d LIMIT 1", serialize($data), $account->uid);
+    db_query("UPDATE {users} SET data = '%s' WHERE uid = %d", serialize($data), $account->uid);
   } 
 
   return;
@@ -78,7 +78,7 @@
           db_query("INSERT INTO {profile_values} (fid,uid,value) VALUES(%d,%d,'%s')", $field->fid, $uid, $value);
         }
         else {
-          db_query("UPDATE {profile_values} SET value = '%s' WHERE fid = %d AND uid = %d LIMIT 1", $value, $field->fid, $uid);  
+          db_query("UPDATE {profile_values} SET value = '%s' WHERE fid = %d AND uid = %d", $value, $field->fid, $uid);  
         }
         
         $data[$field->name] = $value; 
@@ -94,7 +94,7 @@
       db_query("INSERT INTO {profile_values} (fid,uid,value) VALUES(%d,%d,'%s')", $field->fid, $uid, $value);
     }
     else {  
-     db_query("UPDATE {profile_values} SET value = '%s' WHERE fid = %d AND uid = %d LIMIT 1", $value, $field->fid, $uid);
+     db_query("UPDATE {profile_values} SET value = '%s' WHERE fid = %d AND uid = %d", $value, $field->fid, $uid);
       $data[$field->name] = $value;
     }
   }
CommentFileSizeAuthor
#1 user_import.581272.patch1.46 KBmaikeru

Comments

maikeru’s picture

StatusFileSize
new1.46 KB

Hi,

I tried using the above patch, but it rejected them.

The changes worked for me when I manually applied them, so I recreated a patch file.

Patched against version 6.x-2.3.

Cheers,

Michael

the.jxc’s picture

I can confirm this is still broken. Profile import fails when using with Postgresl.

The workaround is as follows (assuming you installed the module into /usr/share/drupal6/modules, otherwise adjust to suit).

# cd /usr/share/drupal6/modules/user_import/supported
# cp profile.inc profile.inc.orig
# perl -pi -e 's/ LIMIT 1//' profile.inc
# diff profile.inc profile.inc.orig
robert castelo’s picture

Status: Active » Fixed

Should be fixed in latest dev version.

I changed the queries to use db_query_range().

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.