• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sometimes get error Duplicate entry for key 'PRIMARY'

#1
A Database Error Occurred
Error Number: 1062
Duplicate entry '8873c26193f493433c2107eabf5b0629730d1428' for key 'PRIMARY'
INSERT INTO `asni_sessions` (`id`, `ip_address`, `timestamp`, `data`) VALUES ('8873c26193f493433c2107eabf5b0629730d1428', '127.0.0.1', 1424801434, '')
Filename: libraries/Session/drivers/Session_database_driver.php
Line Number: 216

   

should i remove PRIMARY key from field 'id' .... ??
Reply

#2
No, but if you want to use 'sess_match_ip', you must add a unique constraint for id, ip_address ... like explained in the manual: http://www.codeigniter.com/userguide3/li...ase-driver
Reply

#3
I'm having the same problem. It seems to be happening on ajax calls, but only over slow connections, perhaps when there is a delay between the initial page content loading and the ajax call being fired.

I'm not using IP address verification, so it's nothing to do with that.

I only noticed the problem when testing a site locally (the basabase is hosted on Amazon RDS though) whilst also uploading a video to YouTube, thus slowing the connection.

The worry is that this issue would affect other users on slow connections.
Reply

#4
(02-24-2015, 12:25 PM)Narf Wrote: No, but if you want to use 'sess_match_ip', you must add a unique constraint for id, ip_address ... like explained in the manual: http://www.codeigniter.com/userguide3/li...ase-driver

it works ...
thank you ... 

Code:
PRIMARY KEY (`id`),
UNIQUE INDEX `id_ip_address` (`id`, `ip_address`),
INDEX `timestamp` (`timestamp`)
)
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.