Welcome Guest, Not a member yet? Register   Sign In
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

(This post was last modified: 02-24-2015, 12:25 PM by Narf.)

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




Theme © iAndrew 2016 - Forum software by © MyBB