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.
| Attachment | Size |
|---|---|
| profile_privacy_install.patch | 368 bytes |

#1
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
#3
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.
#4
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
Automatically closed -- issue fixed for two weeks with no activity.