summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2001-01-17 03:15:20 +0200
committerunknown <monty@donna.mysql.com>2001-01-17 03:15:20 +0200
commit5372aa60ce6c076297815958bbbec2180d919772 (patch)
tree256b185f833ce2fac42471efe65aa7bde9b9a8da /mysql-test
parentf0a33e62a1ed70f3b2393e6548b7a128d7dea3e1 (diff)
downloadmariadb-git-5372aa60ce6c076297815958bbbec2180d919772.tar.gz
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
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/mysql-test-run.sh8
-rw-r--r--mysql-test/r/bdb.result10
-rw-r--r--mysql-test/r/having.result4
-rw-r--r--mysql-test/t/bdb.test22
-rw-r--r--mysql-test/t/having.test10
5 files changed, 46 insertions, 8 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 0bc6d5598c8..3979f1a9339 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -100,10 +100,12 @@ DO_GCOV=""
DO_GDB=""
DO_DDD=""
SLEEP_TIME=2
+DBUSER=""
while test $# -gt 0; do
case "$1" in
- --force ) FORCE=1 ;;
+ --user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;;
+ --force) FORCE=1 ;;
--local) USE_RUNNING_SERVER="" ;;
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
--master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;;
@@ -209,9 +211,9 @@ fi
if [ -n "$USE_RUNNING_SERVER" ]
then
MASTER_MYSOCK="/tmp/mysql.sock"
- DBUSER=test
+ DBUSER=${DBUSER:-test}
else
- DBUSER=root # We want to do FLUSH xxx commands
+ DBUSER=${DBUSER:-root} # We want to do FLUSH xxx commands
fi
if [ -w / ]
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index 218c963e098..00423b7e9e0 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -147,6 +147,12 @@ Table Op Msg_type Msg_text
test.t1 check error The handler for the table doesn't support check/repair
a b
2 testing
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
+t1 1 skr 1 a A 3 NULL NULL
+a b
+1
a b
a 1
a 2
@@ -429,6 +435,8 @@ count(*)
count(*)
1
count(*)
+0
+count(*)
1
count(*)
1
@@ -468,4 +476,4 @@ hello 1
Table Op Msg_type Msg_text
test.t1 optimize status OK
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
-t1 0 PRIMARY 1 a A 1 NULL NULL
+t1 0 PRIMARY 1 a A 2 NULL NULL
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
new file mode 100644
index 00000000000..cbd3fbfff4e
--- /dev/null
+++ b/mysql-test/r/having.result
@@ -0,0 +1,4 @@
+b
+b
+b
+0
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;