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
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

veridicus - February 3, 2005 - 23:34

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

nsk - February 4, 2005 - 21:11

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

veridicus - February 7, 2005 - 18:28

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

veridicus - February 12, 2005 - 21:41

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

nsk - February 12, 2005 - 23:09

good work!

#6

Anonymous - February 26, 2005 - 23:15
 
 

Drupal is a registered trademark of Dries Buytaert.