From time to time, while developing and testing, I get the following error:
A Database Error Occurred
Error Number: 1062
Duplicate entry '[a long key]' for key 'PRIMARY'
INSERT INTO `ci_sessions` (`id`, `ip_address`, `timestamp`, `data`) VALUES ('[same long key]', 'fe80::1', 1435884132, '__ci_last_regenerate|i:1435884132;')
Filename: libraries/Session/drivers/Session_database_driver.php
Line Number: 220
Here is the spec for my sessions table
CREATE TABLE `ci_sessions` (
`id` varchar(40) NOT NULL DEFAULT '0',
`ip_address` varchar(45) NOT NULL DEFAULT '0',
`timestamp` int(10) unsigned NOT NULL DEFAULT '0',
`data` blob NOT NULL,
PRIMARY KEY (`id`),
KEY `ci_sessions_timestamp` (`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
And here is my configuration for sessions:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
Are there approaches to avoiding this kind of error? Do I have my sessions misconfigured?
Thanks for your help in this.