Duplicate entry sql error

coltrane - July 14, 2008 - 21:32
Project:Profile Privacy
Version:6.x-1.1
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

When more than one field is set to private there are errors on submit.

user warning: Duplicate entry '1' for key 1 query: INSERT INTO profile_privacy_values (fid, uid, private) VALUES (2, 1, 1) in /home/bjeavons/dev/contributions/modules/profile_privacy/profile_privacy.module on line 202.

Instead of two separate unique keys for the table profile_privacy_values this patch makes it a combined key off fid and uid.

AttachmentSize
profile_privacy_install.patch368 bytes

#1

quicksketch - July 18, 2008 - 21:49

I think we just need to make the uid and fid normal keys instead of "unique keys". Wouldn't that solve the problem? If we want to add a new key, we should write an update function for people upgrading their existing 5.x installations.

#2

quicksketch - July 18, 2008 - 21:49
Status:needs review» needs work

#3

coltrane - July 18, 2008 - 22:28
Status:needs work» needs review

What do you prefer? Here's a patch that does it with just keys. Either patch works but this matches how it was done in 5, you're right.

AttachmentSize
profile_privacy_install-282610-3.patch 588 bytes

#4

quicksketch - July 20, 2008 - 00:01
Status:needs review» fixed

Thanks, I was just wondering why the keys had been changed. I applied this second patch because it fixes the problem and keeps our database schema consistent across versions of Drupal. If adding additional keys for efficiency, we can provide an upgrade path in a separate patch. I'll release a 1.1.1 version to get out a release that works properly. Thanks for your help!

#5

Anonymous (not verified) - August 3, 2008 - 00:02
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.