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;
}
}
Comments
Comment #1
maikeru commentedHi,
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
Comment #2
the.jxc commentedI 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).
Comment #3
robert castelo commentedShould be fixed in latest dev version.
I changed the queries to use db_query_range().