2000-12-28 02:56:38 +01:00
|
|
|
#
|
|
|
|
# Check for problems with delete
|
|
|
|
#
|
|
|
|
|
2000-12-21 10:58:02 +01:00
|
|
|
drop table if exists t1;
|
2000-12-28 02:56:38 +01:00
|
|
|
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
|
|
|
|
INSERT INTO t1 VALUES (1,1);
|
|
|
|
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
|
|
|
|
INSERT INTO t1 VALUES (1,3);
|
|
|
|
DELETE from t1 where a=1 limit 1;
|
|
|
|
DELETE LOW_PRIORITY from t1 where a=1;
|
|
|
|
|
|
|
|
INSERT INTO t1 VALUES (1,1);
|
|
|
|
DELETE from t1;
|
|
|
|
LOCK TABLE t1 write;
|
|
|
|
INSERT INTO t1 VALUES (1,2);
|
|
|
|
DELETE from t1;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
INSERT INTO t1 VALUES (1,2);
|
|
|
|
SET AUTOCOMMIT=0;
|
|
|
|
DELETE from t1;
|
|
|
|
SET AUTOCOMMIT=1;
|
|
|
|
drop table t1;
|
2000-12-21 10:58:02 +01:00
|
|
|
|
2000-12-28 02:56:38 +01:00
|
|
|
#
|
|
|
|
# Test of delete when the delete will cause a node to disappear and reappear
|
|
|
|
# (This assumes a block size of 1024)
|
|
|
|
#
|
2000-12-21 10:58:02 +01:00
|
|
|
|
2000-12-28 02:56:38 +01:00
|
|
|
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
|
|
|
|
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
|
|
|
|
delete from t1 where a=26;
|
|
|
|
drop table t1;
|
|
|
|
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
|
|
|
|
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
|
|
|
|
delete from t1 where a=27;
|
2000-12-21 10:58:02 +01:00
|
|
|
drop table t1;
|
2003-03-04 18:02:56 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# CHAR(0) bug - not actually DELETE bug, but anyway...
|
|
|
|
#
|
|
|
|
|
|
|
|
CREATE TABLE t1 (
|
|
|
|
bool char(0) default NULL,
|
|
|
|
not_null varchar(20) binary NOT NULL default '',
|
|
|
|
misc integer not null,
|
|
|
|
PRIMARY KEY (not_null)
|
|
|
|
) TYPE=MyISAM;
|
|
|
|
|
|
|
|
INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7);
|
|
|
|
|
|
|
|
select * from t1 where misc > 5 and bool is null;
|
|
|
|
delete from t1 where misc > 5 and bool is null;
|
|
|
|
select * from t1 where misc > 5 and bool is null;
|
|
|
|
|
2003-05-03 18:08:11 +02:00
|
|
|
select count(*) from t1;
|
|
|
|
delete from t1 where 1 > 2;
|
|
|
|
select count(*) from t1;
|
|
|
|
delete from t1 where 3 > 2;
|
|
|
|
select count(*) from t1;
|
|
|
|
|
2003-03-04 18:02:56 +01:00
|
|
|
drop table t1;
|
|
|
|
|
2004-10-01 13:23:54 +02:00
|
|
|
#
|
|
|
|
# Bug #5733: Table handler error with self-join multi-table DELETE
|
|
|
|
#
|
|
|
|
|
|
|
|
create table t1 (a int not null auto_increment primary key, b char(32));
|
|
|
|
insert into t1 (b) values ('apple'), ('apple');
|
|
|
|
select * from t1;
|
|
|
|
delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
|
|
|
|
select * from t1;
|
|
|
|
drop table t1;
|
2005-02-16 03:45:42 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Bug #8392: delete with ORDER BY containing a direct reference to the table
|
|
|
|
#
|
|
|
|
|
|
|
|
CREATE TABLE t1 ( a int PRIMARY KEY );
|
|
|
|
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
|
|
|
|
INSERT INTO t1 VALUES (0),(1),(2);
|
|
|
|
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
DROP TABLE t1;
|