List:Internals« Previous MessageNext Message »
From:Paul Cadach Date:November 19 0100 8:20am
Subject:Bug in MyISAM with auto_increment fields!
View as plain text  
Hi,

I have a table with next structure:
CREATE TABLE pays (
  id int(11) unsigned DEFAULT '0' NOT NULL,
  phone mediumint(7) DEFAULT '0' NOT NULL,
  org_code smallint(4) DEFAULT '0' NOT NULL,
  org_dep smallint(4) DEFAULT '0' NOT NULL,
  maket smallint(3) DEFAULT '0' NOT NULL,
  payment float(9,2) DEFAULT '0.00' NOT NULL,
  paydate datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
  operator smallint(3) DEFAULT '0' NOT NULL,
  status tinyint(1) DEFAULT '0' NOT NULL,
  _rowid int(11) unsigned NOT NULL auto_increment,
  PRIMARY KEY (_rowid),
  UNIQUE i1 (status,_rowid)
);

As you can see, _rowid field marked as auto_increment.

When I uploads payments I'm just creates temporary table as:
	CREATE TEMPORARY TABLE pays_tmp SELECT * FROM pays LIMIT 0
to follow the pays' table structure and then inserts records
into temporary table pays_tmp. After insertion is finished, I
flushes new records into main table pays by:
	INSERT INTO pays SELECT * FROM pays
At some sequential inserts I have two records with identical
_rowid field at pays table (if I inserts 470 records twice I have
duplicate at _rowid=470), i.e. the value of last time inserted
record is the value of the first currently inserting record.

This bug doesn't appear at ISAM table hanlder and doesn't applies
for regular inserts.


MySQL version used for tests is 3.23.26-beta.


WBR,
Paul.
-- 
Paul Cadach, Leading Software Engineer
IT Department
East-Kazakhstan Regional Board of Telecommunications
Thread
Bug in MyISAM with auto_increment fields!Paul Cadach24 Nov
  • Re: Bug in MyISAM with auto_increment fields!Beotel24 Nov