From 5372aa60ce6c076297815958bbbec2180d919772 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Jan 2001 03:15:20 +0200 Subject: Fixed for bugs that was found when getting full code coverage of BDB Fixed bug with HEAP tables on windows Fixed bug with HAVING on empty tables Docs/manual.texi: Update of UDF functions mysql-test/mysql-test-run.sh: Added option --user mysql-test/r/bdb.result: Added more test to get better coverage mysql-test/t/bdb.test: Added more test to get better coverage sql/field.cc: Fixes for key packing in BDB sql/field.h: Fixes for key packing in BDB sql/ha_berkeley.cc: Fixed for bugs that was found when getting full code coverage sql/ha_heap.cc: Fixed problem with HEAP tables on windows sql/log.cc: Safety fix sql/sql_select.cc: Fixed bug with HAVING on empty tables sql/table.cc: Fixed problem with HEAP tables on windows --- mysql-test/t/bdb.test | 22 ++++++++++++++++++---- mysql-test/t/having.test | 10 ++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 mysql-test/t/having.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test index cf6d28c47b0..5f8ef3ff18e 100644 --- a/mysql-test/t/bdb.test +++ b/mysql-test/t/bdb.test @@ -4,7 +4,7 @@ # Small basic test with ignore # -drop table if exists t1; +drop table if exists t1,t2; create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=bdb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); @@ -81,6 +81,17 @@ create table t1 (a int,b varchar(20)) type=bdb; insert into t1 values (1,""), (2,"testing"); delete from t1 where a = 1; select * from t1; +create index skr on t1 (a); +insert into t1 values (3,""), (4,"testing"); +analyze table t1; +show keys from t1; +drop table t1; + +# Test of reading on secondary key with may be null + +create table t1 (a int,b varchar(20),key(a)) type=bdb; +insert into t1 values (1,""), (2,"testing"); +select * from t1 where a = 1; drop table t1; # @@ -352,12 +363,15 @@ CREATE TABLE t1 ( INDEX sca_pic (sca_pic) ) type = bdb ; -INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'J', 'RING', 'EN', 'not null', NULL, 'RING'); +INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); select count(*) from t1 where sca_code = 'PD'; select count(*) from t1 where sca_code <= 'PD'; select count(*) from t1 where sca_pic is null; alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); select count(*) from t1 where sca_code='PD' and sca_pic is null; +select count(*) from t1 where cat_code='E'; + + alter table t1 drop index sca_pic, add index (sca_pic, cat_code); select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_pic >= 'n'; @@ -385,7 +399,7 @@ flush logs; # # Test key on blob with null values # -create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))); +create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) type=bdb; insert into t1 values ('this is a blob', 1), (null, -1), (null, null),("",1),("",2),("",3); select b from t1 where b = 'this is a blob'; select * from t1 where b like 't%'; @@ -399,7 +413,7 @@ drop table t1; # # Test with variable length primary key # -create table t1 (a varchar(100) not null, primary key(a), b int not null); +create table t1 (a varchar(100) not null, primary key(a), b int not null) type=bdb; insert into t1 values("hello",1),("world",2); select * from t1 order by b desc; optimize table t1; diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test new file mode 100644 index 00000000000..a952f5e8d5c --- /dev/null +++ b/mysql-test/t/having.test @@ -0,0 +1,10 @@ +# test of problems with having (Reported by Mark Rogers) +# + +drop table if exists t1; +create table t1 (a int); +select count(a) as b from t1 where a=0 having b > 0; +insert into t1 values (null); +select count(a) as b from t1 where a=0 having b > 0; +select count(a) as b from t1 where a=0 having b >=0; +drop table t1; -- cgit v1.2.1