Database error - Duplicate entry 'upload_create_album_directory' for key... Database error - Duplicate entry 'upload_create_album_directory' for key...
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Database error - Duplicate entry 'upload_create_album_directory' for key...

Started by drcstang, March 01, 2023, 04:32:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

drcstang

After doing an upgrade from 1.6.20 to 1.6.22, I got the following error on the database upgrade page:

QuoteINSERT INTO cpg_config VALUES ('upload_create_album_directory', '1')
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'upload_create_album_directory' for key 'cpg_config.PRIMARY' in /var/www/cm/include/database/pdo/dbase.inc.php:49 Stack trace: #0 /var/www/cm/include/database/pdo/dbase.inc.php(49): PDO->query() #1 /var/www/cm/include/functions.inc.php(202): CPG_Dbase->query() #2 /var/www/cm/update.php(547): cpg_db_query() #3 /var/www/cm/update.php(405): update_tables() #4 /var/www/cm/update.php(151): start_update() #5 {main} thrown in /var/www/cm/include/database/pdo/dbase.inc.php on line 49

The prior steps all show no issue:
QuoteUPDATE cpg_albums SET moderator_group = 0   Already Done
UPDATE cpg_users SET `user_lastvisit`='1000-01-01 00:00:00' WHERE `user_lastvisit`='0000-00-00 00:00:00'   Already Done
UPDATE cpg_users SET `user_regdate`='1000-01-01 00:00:00' WHERE `user_regdate`='0000-00-00 00:00:00'   Already Done
UPDATE cpg_comments SET `msg_date`='1000-01-01 00:00:00' WHERE `msg_date`='0000-00-00 00:00:00'   Already Done
UPDATE cpg_pictures SET `mtime`='1000-01-01 00:00:00' WHERE `mtime`='0000-00-00 00:00:00'   Already Done

I can see the error indicates a duplicate entry, but have little database experience to dig much deeper. Is there a way to clean this up?

ron4mac

I can't duplicate your issue. Something may have changed with your system and/or database. You may want to run a repair on your database.
Nothing has actually changed with the CPG database tables and fields since CPG 1.6.05, so the update not running correctly should not cause any direct problem.

Sorry ... had not noticed that you are using PDO(mysql). Quick fix (and recommended) is to use mysqli. Just change pdo:mysql to mysqli in your include/config.inc.php file.

I will look into the PDO(mysql) issue.

ron4mac

A correction for your issue with the use of PDO(mysql) has been made and will be included in the next release (1.6.23).

drcstang

Quote from: ron4mac on March 01, 2023, 10:09:10 PM
Nothing has actually changed with the CPG database tables and fields since CPG 1.6.05, so the update not running correctly should not cause any direct problem.

Sorry ... had not noticed that you are using PDO(mysql). Quick fix (and recommended) is to use mysqli. Just change pdo:mysql to mysqli in your include/config.inc.php file.

I will look into the PDO(mysql) issue.
Thank you very much for the quick response.

I very well may have been having the issue with this since 1.6.05 and never noticed until this upgrade (obviously no reason to be running the "update database" regularly).

I switched to 'mysqli'.  I have no idea why I was using pdo, but the mysqli is working just fine from my quick test.

If for some reason you want me to test the pdo connection in the , let me know.