List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:January 15 2002 2:30pm
Subject:Re: Insert failed
View as plain text  
Looks like someone entered a  negative number for EventId, or it just 
reached its maximum value.
Check its maximum and minimum values.

Change it to an unsigned int.

Xavier NOPRE wrote:

>Hi,
>
>I try to insert a new record in a table. The key is an automatic ID.
>The insert is refused due to duplicate key, but the key does not
>exist. Why ? Is it a bug ?
>
>
>Any idea ? Some help ?
>Thanks
>
>Xavier
>
>
>Details:
>
>The colums of the table:
>+----------------+--------------+------+-----+---------+----------------+
>| Field          | Type         | Null | Key | Default | Extra        
>| +----------------+--------------+------+-----+---------+----------------+
>| EventType      | varchar(64)  | YES  |     | NULL    |              
>|
>| EventOrigin    | varchar(64)  | YES  |     | NULL    |              
>|
>| EventText      | varchar(250) | YES  |     | NULL    |              
>|
>| EventTimeStamp | datetime     | YES  |     | NULL    |              
>|
>| EventId        | int(11)      |      | PRI | NULL    |
>auto_increment |
>+----------------+--------------+------+-----+---------+----------------+
>
>Operations tried:
>
>mysql> select count(*) from events;
>+----------+
>| count(*) |
> +----------+
>|    20506 |
>+----------+
>1 row in set (0.19 sec)
>mysql> insert into events set EventType='TEST',EventOrigin='me';
>ERROR 1062: Duplicate entry '20507' for key 1
>mysql> select * from events where EventId=20507;
>Empty set (0.00 sec)
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>   http://www.mysql.com/manual.php   (the manual)
>   http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread96380@stripped>
>To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


Thread
Insert failedXavier NOPRE15 Jan
  • Re: Insert failedGerald Clark15 Jan