[MySQL] FAKE DUPLICATE ROW
| From: | Alessandro Vitale | Date: | Fri, 20 Feb 2004 13:31:02 +0000 |
| Subject: | [MySQL] FAKE DUPLICATE ROW | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178340@lists.php.net to get a copy of this message | ||
I have this table on my MYSQL 4.0.16 :
CREATE TABLE
pls_in_row (
row_id int(11) NOT NULL auto_increment,
pls_id int(11) default NULL,
code int(20) default NULL,
description varchar(255) default NULL,
valid_from date default NULL,
PRIMARY KEY (row_id),
UNIQUE KEY pls_row (code,pls_id,valid_from)
) TYPE=MyISAM
when I push data into the table with a "INSERT IGNORE" statement, everything
works fine as long as 'code' is not longer than 9 digits. When I try to
insert records with 'code' longer than 9 digits, mysql does not distinguish
anymore in the index... so for example if I perform the following, the
second statement does not insert anything as the row was duplicate, but
actually is not:
INSERT IGNORE INTO pls_in_row SET pls_id = 17, code = 372622701, valid_from
= '2004-01-01';
> affeted rows: 1;
INSERT IGNORE INTO pls_in_row SET pls_id = 17, code = 3726227013, valid_from
= '2004-01-01';
> affected rows: 0;
leaving out the 'IGNORE' I get this...
> ERROR 1062: Duplicate entry '2147483647-17-2004-02-01' for key 2
so that seems that mysql has created a completely wrong key for this row!
my question is: is there a limit for the integer part of the index, or a bug
any suggestion would be very much appreciated.
cheers
alessandro