Bug #4818 delete with limit clause generates error
Submitted: 30 Jul 2004 0:01 Modified: 4 Aug 2004 11:56
Reporter: Justin Swanhart Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:mysql-4.1.4-beta (Source distribution) OS:Linux (RHAS 3)
Assigned to: Magnus Blåudd CPU Architecture:Any

[30 Jul 2004 0:01] Justin Swanhart
Description:
DELETE FROM TABLE LIMIT generates an erorr 499 frovi Sm the cluster engine

[/home/swanhart/scripts]: perl bug.pl
10 records inserted
DBD::mysql::db do failed: Got error 499 from storage engine at bug.pl line 28.
DBD::mysql::db do failed: Got error 499 from storage engine at bug.pl line 28.

How to repeat:
#Here is a perl script that easily demonstrates the problem:
$| = 1;
use DBI();

#please set appropriate values for your mysql instance
$dbuser = "";
$dbpass = "";
$dbname = "test";
$dbhost = "localhost";

#make the connection
$dsn = "DBI:mysql:database=$dbname;host=$dbhost";
$dbh = DBI->connect($dsn, $dbuser, $dbpass) or die ("could not connect!");
$dbh->{ 'AutoCommit' } = 1 ;
$dbh->{ 'RaiseError' } = 1 ;

#create a table to store the records in
$dbh->do("create table testtable (id int auto_increment, val int, primary key(id)) engine=NDB");

#insert some rows
for ($i=0;$i<10;$i++) {
  $dbh->do("insert into testtable (val) values ($i)");
}
print "$i records inserted\n";
#this statement will generate an error
$dbh->do("delete from testtable limit 1");
[4 Aug 2004 11:08] Magnus Blåudd
Commited fix that checks for pending operations to take over before closing the scan.