The update operation has a primary key conflict error, and if such a problem arises, you will find it inconceivable.
mysql> UPDATE ' gc_price ' SET ' price ' = ' 155.00 ', ' opttime ' = ' 2013-07-01 16:12:36 ' where ' crcode ' = ' 0109 ' WHERE (prid = 364 706189);
ERROR 1062 (23000): Duplicate entry ' 2147483647 ' for key ' PRIMARY '
The maximum value of the primary key prid of my gc_price table is: 437573062, and there is no record of a primary key of ' 2147483647 ' in the table.
2147483647: Note that the maximum value of this int, do not believe, you calculate by calculator. Should be the table's self-added primary key reached the maximum value ... Store code such as a foreign key association or trigger ...
Since a primary key conflict is not a gc_price table, it can only be caused by other code. Look at that.triggers,
Mysql> show triggers like '%price% ' \g;
1. Row ***************************
Trigger:t_price_changed_prid_insert
Event:insert
Table:gc_price
Statement:insert into be_prid_changed (prid,type) VALUES (NEW. prid,1);
Timing:after
Created:null
Sql_mode:
Definer:root@localhost
Character_set_client:utf8
Collation_connection:utf8_general_ci
Database Collation:utf8_general_ci
2. Row ***************************
Trigger:t_price_changed_prid_update
Event:update
Table:gc_price
Statement:insert into be_prid_changed (prid,type) VALUES (NEW. prid,2)
Timing:after
Created:null
Sql_mode:
Definer:root@localhost
Character_set_client:utf8
Collation_connection:utf8_general_ci
Database Collation:utf8_general_ci
2 rows in Set (0.00 sec)
View the structure of table be_prid_changed
Mysql> Show CREATE TABLE be_prid_changed\g;
1. Row ***************************
Table:be_prid_changed
Create table:create Table ' be_prid_changed ' (
' id ' int () not NULL auto_increment,
' Prid ' int () not NULL COMMENT ' source Prid ',
' Type ' tinyint (1) Not NULL COMMENT ' 1 to insert 2 from update ',
' Createdtime ' timestamp not NULL DEFAULT current_timestamp on UPDATE current_timestamp COMMENT ' creation time ',
' Status ' tinyint (1) DEFAULT ' 1 ' COMMENT ' 1 to be processed 2 processed ',
PRIMARY KEY (' id ')
) Engine=myisam auto_increment=2147483648 DEFAULT Charset=utf8
1 row in Set (0.00 sec)
The value of the auto_increment=2147483648 has reached the maximum, and the "true" culprit for the update's primary key conflict has been found.
Solutions, many:
1) Delete the trigger directly (if it doesn't work ...) )
2) Rename the table and recreate the same empty table.