diff options
Diffstat (limited to 'mysql-test/t/heap.test')
-rw-r--r-- | mysql-test/t/heap.test | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index abb9e1fd1bc..ef7e3239a96 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -19,6 +19,12 @@ drop table t1; create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps"; insert into t1 values(1,1),(2,2),(3,3),(4,4); +delete from t1 where a > 0; +select * from t1; +drop table t1; + +create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps"; +insert into t1 values(1,1),(2,2),(3,3),(4,4); alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table"; #show table status like "t1"; select * from t1; @@ -100,3 +106,35 @@ update t1 set new_col=btn; explain select * from t1 where btn="a"; explain select * from t1 where btn="a" and new_col="a"; drop table t1; + +# +# Test of NULL keys +# + +CREATE TABLE t1 ( + a int default NULL, + b int default NULL, + KEY a (a), + UNIQUE b (b) +) type=heap; +INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3); +SELECT * FROM t1 WHERE a=NULL; +explain SELECT * FROM t1 WHERE a IS NULL; +SELECT * FROM t1 WHERE a<=>NULL; +SELECT * FROM t1 WHERE b=NULL; +explain SELECT * FROM t1 WHERE b IS NULL; +SELECT * FROM t1 WHERE b<=>NULL; + +--error 1062 +INSERT INTO t1 VALUES (1,3); +DROP TABLE t1; + +# +# Test when deleting all rows +# + +CREATE TABLE t1 (a int not null, primary key(a)) type=heap; +INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11); +DELETE from t1 where a < 100; +SELECT * from t1; +DROP TABLE t1; |