ADODB_Exception Duplicate Entry error
Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysql error: [1062: Duplicate entry '258-66' for key 1] in EXECUTE("insert into CollectionVersionBlockStyles (cID, cvID, bID, arHandle, csrID) values ('66', '11', '258', 'Main', 0)") ' in public_html/concrete/libraries/3rdparty/adodb/adodb-exceptions.inc.php:78 Stack trace: #0 public_html/concrete/libraries/3rdparty/adodb/adodb.inc.php(1037): adodb_throw('mysql', 'EXECUTE', 1062, 'Duplicate entry...', 'insert into Col...', false, Object(ADODB_mysql)) #1 /public_html/concrete/libraries/3rdparty/adodb/adodb.inc.php(993): ADOConnection->_Execute('insert into Col...') #2 /public_html/concrete/libraries/database.php(73): ADOConnection->Execute('insert into Col...', Array) #3 [internal function]: Database->__call(Array, Array) #4 /public_html/concrete/models/block.php(404): Database->Execute('Execute', Array) #5 /public_html/concrete/startup/process.php(624): Block->alias('insert in /public_html/concrete/libraries/3rdparty/adodb/adodb-exceptions.inc.php on line 78
I've found a number of similar problems in the forums but none of their fixes have worked yet. Any ideas?
Though the information at that link is out of date due to the recent change in the Concrete5 database table names. So instead of the table 'collectionversionblockstyles' this is table name CollectionVersionBlockStyles. Here are the mysql edits I made.
Deleted table: CollectionVersionBlockStyles
Then ran this mysql query.
CREATE TABLE IF NOT EXISTS `CollectionVersionBlockStyles` ( `bID` int(10) unsigned NOT NULL DEFAULT '1', `cID` int(10) unsigned NOT NULL DEFAULT '1', `cvID` int(10) unsigned NOT NULL DEFAULT '0', `arHandle` varchar(255) NOT NULL, `csrID` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`bID`,`cID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;,
and this one
Just wanted to add that the table names haven't changed, but it rather depends on whether your database runs on a system that is case-sensitive (e.g. Linux/UNIX) or case-insensitive (e.g. Windows) (and it might also have to do with the MySQL-specific setting "lower case table names"):
For example, on my Xampp setup on Windows XP, all table names are lower-case; and on my webhost's linux server all table names are in "camel-case" as in your description.
I'm still not sure if that's critical, but I would also change the "DEFAULT '1'" part of `cID` and `bID` to '0':
ALTER TABLE `CollectionVersionBlockStyles` MODIFY COLUMN `bID` INTEGER UNSIGNED NOT NULL DEFAULT 0, MODIFY COLUMN `cID` INTEGER UNSIGNED NOT NULL DEFAULT 0;
Was wondering if you know how to deal with this duplicate key problem re: page attributes? I am very clueless, not even sure where/how to edit the database, if in fact that's what is required...
Had the same problem with a site, your queries solved my problem - many thanks for posting these!