ERROR 1062 at line 88: Duplicate entry 'copyrights_cpyid' for key 1
nsk - February 3, 2005 - 23:06
| Project: | Copyright |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
When I upgrade the database I get this error:
ERROR 1062 at line 88: Duplicate entry 'copyrights_cpyid' for key 1
I tried to install Copyright 4.5.0 on Drupal 4.5.2

#1
There's only been one release of the mysql file, so no upgrade is necessary. I'm assuming, though, that you dropped the copyright tables and re-ran the script. Unfortunately there's no IF statement possible in mysql scripts, so I have to perform an insert without checking if the key already exists. So you have 2 choices: comment out the line that starts with "INSERT INTO seqences" or delete that record from sequences before running the script.
I wish mysql scripts could have some batch processing logic so we could check things before creating/inserting, but we can't.
#2
I think there is an SQL construct "IF NOT EXISTS".
Yes it is true that I ran the script after I removed the cvs version. However, IIRC I dropped the copyright table.
#3
I changed the mysql script so it'll work for installs as well as upgrades. I'll check it into CVS after some testing, hopefully tonight.
#4
The mysql file has been updated in CVS. You can now run the mysql file as many times as you like (i.e. for first-time installs as well as upgrades). Run it with -f (--force) and it will always work, adding new columns as needed.
#5
good work!
#6