summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-09-03 15:44:25 +0300
committerunknown <monty@mashka.mysql.fi>2002-09-03 15:44:25 +0300
commit9266dcd6e7cdb876812035a3c588d5e11bbe8db7 (patch)
tree14062338992e5b5bda3d4e4cc498b6dd65a5a9c0 /mysql-test
parent74ece045ae67798e629f06d2833932167746c2ab (diff)
downloadmariadb-git-9266dcd6e7cdb876812035a3c588d5e11bbe8db7.tar.gz
Some trivial optimzations
Check if AND/OR expression can be NULL; Fixed bug in GROUP BY and-or-expression where expression could be NULL Bug fix for SHOW OPEN TABLES when user didn't have privilege to access all open tables. Better fix for ALTER TABLE on BDB tables. Docs/manual.texi: Changelog client/mysql.cc: Simple optimization libmysql/libmysql.c: Removed initialization of varibles that are already set to zero myisam/myisamchk.c: Fixed comment for extend-check mysql-test/r/bdb-alter-table-1.result: Updated results mysql-test/r/bdb-alter-table-2.result: Updated results mysql-test/r/distinct.result: Updated results after bug fix mysql-test/r/handler.result: Updated results mysql-test/r/innodb_handler.result: Updated results mysql-test/r/select.result: Updated results mysql-test/r/varbinary.result: Updated results mysql-test/t/bdb-alter-table-1.test: Added comments mysql-test/t/bdb-alter-table-2.test: Added comments mysql-test/t/select.test: Remove OPTION in SET OPTION Added tests for ORDER BY key LIMIT sql/item_cmpfunc.cc: Check if AND/OR expression can be NULL sql/mysqld.cc: mysqld --help now shows value of datadir sql/share/english/errmsg.txt: Better error message for syntax error sql/sql_base.cc: Bug fix for SHOW OPEN TABLES sql/sql_class.cc: Moved virtual function to .cc file to avoid that we have to include assert.h everywhere. sql/sql_class.h: Moved virtual function to .cc file to avoid that we have to include assert.h everywhere. sql/sql_parse.cc: Removed old dead code from 3.23 sql/sql_select.cc: Improved optimization of ORDER BY key LIMIT sql/sql_table.cc: More comments, Better fix for ALTER TABLE on BDB tables.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/bdb-alter-table-1.result7
-rw-r--r--mysql-test/r/bdb-alter-table-2.result2
-rw-r--r--mysql-test/r/distinct.result3
-rw-r--r--mysql-test/r/handler.result2
-rw-r--r--mysql-test/r/innodb_handler.result2
-rw-r--r--mysql-test/r/select.result20
-rw-r--r--mysql-test/r/varbinary.result2
-rw-r--r--mysql-test/t/bdb-alter-table-1.test7
-rw-r--r--mysql-test/t/bdb-alter-table-2-master.opt2
-rw-r--r--mysql-test/t/bdb-alter-table-2.test7
-rw-r--r--mysql-test/t/select.test16
11 files changed, 54 insertions, 16 deletions
diff --git a/mysql-test/r/bdb-alter-table-1.result b/mysql-test/r/bdb-alter-table-1.result
index 3742f45eb7a..095d89355ad 100644
--- a/mysql-test/r/bdb-alter-table-1.result
+++ b/mysql-test/r/bdb-alter-table-1.result
@@ -1,4 +1,11 @@
+drop table if exists t1;
+create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
+insert into t1 values(1, 't1',4,9);
+insert into t1 values(2, 'metatable',1,9);
+insert into t1 values(3, 'metaindex',1,9 );
+select * from t1;
objid tablename oid test
1 t1 4 9
2 metatable 1 9
3 metaindex 1 9
+alter table t1 drop column test;
diff --git a/mysql-test/r/bdb-alter-table-2.result b/mysql-test/r/bdb-alter-table-2.result
index 19c6d5e1ff9..c23b5ba0031 100644
--- a/mysql-test/r/bdb-alter-table-2.result
+++ b/mysql-test/r/bdb-alter-table-2.result
@@ -1,4 +1,6 @@
+select * from t1;
objid tablename oid
1 t1 4
2 metatable 1
3 metaindex 1
+drop table t1;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 312e7893949..da2bc3c7146 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -92,7 +92,8 @@ NULL NULL NULL
0 0
select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
grp count(*)
-0 7
+NULL 1
+0 6
1 6
SELECT DISTINCT FACILITY FROM t1;
FACILITY
diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result
index d495dde75bf..35765c48049 100644
--- a/mysql-test/r/handler.result
+++ b/mysql-test/r/handler.result
@@ -134,6 +134,6 @@ handler t2 read next;
a b
19 fff
handler t2 read last;
-You have an error in your SQL syntax near '' at line 1
+You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
handler t2 close;
drop table if exists t1;
diff --git a/mysql-test/r/innodb_handler.result b/mysql-test/r/innodb_handler.result
index 73368c932af..a55114a0e3d 100644
--- a/mysql-test/r/innodb_handler.result
+++ b/mysql-test/r/innodb_handler.result
@@ -134,6 +134,6 @@ handler t2 read next;
a b
19 fff
handler t2 read last;
-You have an error in your SQL syntax near '' at line 1
+You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
handler t2 close;
drop table if exists t1;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 26c84af1618..88220b75591 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -1718,7 +1718,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
-SET OPTION SQL_BIG_TABLES=1;
+SET SQL_BIG_TABLES=1;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
@@ -1731,7 +1731,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
-SET OPTION SQL_BIG_TABLES=0;
+SET SQL_BIG_TABLES=0;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
@@ -1768,7 +1768,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET OPTION SQL_BIG_TABLES=1;
+SET SQL_BIG_TABLES=1;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
@@ -1781,7 +1781,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
-SET OPTION SQL_BIG_TABLES=0;
+SET SQL_BIG_TABLES=0;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
@@ -1809,6 +1809,18 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
table type possible_keys key key_len ref rows Extra
t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
+table type possible_keys key key_len ref rows Extra
+t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+t3 ref period period 4 t1.period 4181
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+table type possible_keys key key_len ref rows Extra
+t3 index period period 4 NULL 41810
+t1 ref period period 4 t3.period 4181
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+table type possible_keys key key_len ref rows Extra
+t1 index period period 4 NULL 41810
+t3 ref period period 4 t1.period 4181
select period from t1;
period
9410
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index 75ff9c3976b..4eb34ebfd63 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -16,7 +16,7 @@ table type possible_keys key key_len ref rows Extra
t1 const UNIQ UNIQ 8 const 1
drop table t1;
select x'hello';
-You have an error in your SQL syntax near 'x'hello'' at line 1
+You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'x'hello'' at line 1
select 0xfg;
Unknown column '0xfg' in 'field list'
create table t1 select 1 as x, 2 as xx;
diff --git a/mysql-test/t/bdb-alter-table-1.test b/mysql-test/t/bdb-alter-table-1.test
index 25a86cd92f6..5861c2fe0bf 100644
--- a/mysql-test/t/bdb-alter-table-1.test
+++ b/mysql-test/t/bdb-alter-table-1.test
@@ -1,8 +1,7 @@
--- source include/have_bdb.inc
-
#
-# Small basic test for ALTER TABLE bug ..
+# Test of problem when shutting down mysqld at once after ALTER TABLE
#
+-- source include/have_bdb.inc
drop table if exists t1;
create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
insert into t1 values(1, 't1',4,9);
@@ -10,3 +9,5 @@ insert into t1 values(2, 'metatable',1,9);
insert into t1 values(3, 'metaindex',1,9 );
select * from t1;
alter table t1 drop column test;
+
+# Now we do a reboot and continue with the next test
diff --git a/mysql-test/t/bdb-alter-table-2-master.opt b/mysql-test/t/bdb-alter-table-2-master.opt
new file mode 100644
index 00000000000..15ad73c500f
--- /dev/null
+++ b/mysql-test/t/bdb-alter-table-2-master.opt
@@ -0,0 +1,2 @@
+--skip-external-locking
+
diff --git a/mysql-test/t/bdb-alter-table-2.test b/mysql-test/t/bdb-alter-table-2.test
index 69ff04ee24a..a474efe42e1 100644
--- a/mysql-test/t/bdb-alter-table-2.test
+++ b/mysql-test/t/bdb-alter-table-2.test
@@ -1,3 +1,8 @@
+#
+# Note that this test uses tables from the previous test
+# This is to test that the table t1 survives a reboot of MySQL
+# The options in the -master.opt file are just there to force the reboot
+#
-- source include/have_bdb.inc
select * from t1;
-drop table t1; \ No newline at end of file
+drop table t1;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 4dd833616d5..94806d44e37 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -1405,9 +1405,9 @@ drop table tmp;
# big table done
-SET OPTION SQL_BIG_TABLES=1;
+SET SQL_BIG_TABLES=1;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
-SET OPTION SQL_BIG_TABLES=0;
+SET SQL_BIG_TABLES=0;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
select distinct fld5 from t2 limit 10;
@@ -1416,9 +1416,9 @@ select distinct fld5 from t2 limit 10;
#
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
-SET OPTION SQL_BIG_TABLES=1; # Force use of MyISAM
+SET SQL_BIG_TABLES=1; # Force use of MyISAM
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
-SET OPTION SQL_BIG_TABLES=0;
+SET SQL_BIG_TABLES=0;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
#
@@ -1440,6 +1440,14 @@ select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr orde
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
#
+# Some test with ORDER BY and limit
+#
+
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+
+#
# Search with a constant table.
#