Closed (fixed)
Project:
Privatemsg
Version:
5.x-1.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
26 Feb 2007 at 03:33 UTC
Updated:
14 Mar 2007 at 02:17 UTC
user warning: Duplicate entry '2' for key 1 query: INSERT INTO privatemsg (id, author, recipient, subject, message, timestamp, newmsg, hostname, format) VALUES (2, 1, 2, 'test', 'test', 1172460676, 1, '61.29.36.18', 1) in includes/database.mysql.inc on line 172.
Comments
Comment #1
neubreed commentedFor some reason the sequences table went back to zero for the privatemsg_id value. Do you think this was a one off?
Comment #2
airblaster commentedIf I'm not mistaken the install script ignores table prefixes, which causes the sequences table beeing filled with wrong data.
Comment #3
mindless commentedAre you using postgresql DB and you have a table prefix? The upgrade code is in fact missing the prefix for this db type, I'll fix that. Please confirm if this is your configuration so we can tell if there is also another problem.
Comment #4
mindless commentedNo, I take that back.. looking closer I think the prefix handling is ok in the upgrade code. airblaster, where do you see missing prefix?
neubreed, what is your db type and do you use a table prefix?
if mysql, what do you get for SELECT * from sequences where name like '{privatemsg%';
and SELECT max(id) from privatemsg;
(add prefix to table names if needed)
Comment #5
airblaster commentedI've done some testing to get the actual error messages.
I get the following error messages after executing the update from 1.3 to 1.4:
Database: MySQL
Test data: 2 folders and 2 private messages
After the update, the follwing sequences are in drupal_sequences:
privatemsg_folder_fid with value 0
privatemsg_id with value 0
Note that (unlike most other entries in the sequences table) these entries don't have any table prefix.
Comment #6
mindless commentedWhat is your drupal version and php version? All the queries here have { } around the table names, so I don't know why the prefix wouldn't be applied.
Comment #7
mindless commentedAlso, what is your $db_prefix definition from your settings file?
Comment #8
airblaster commentedMy Drupal Version is 5.1, $db_prefix is 'drupal_'.
I've used VertrigoServ 2.14 (on Windows XP) for the tests, which comes with PHP 5.2.0.
I've not looked at the code for sequences, but could the problem possibly be caused by the values of the inserts I quoted before?:
(e.g. with $db_prefix='drupal_', should it possibly be drupal_privatemsg_id instead of privatemsg_id?)
Comment #9
mindless commentedack, got it. i didn't realize that { } meant something in PHP strings.. fixed in DRUPAL-5 branch. i'll do a new release asap so others with db_prefix don't hit this. thanks for the debug help!
Comment #10
neubreed commentedSorry for the late reply, had no net for a few days.. db type is MySQL.. better late than never ;)
Comment #11
(not verified) commented