summaryrefslogtreecommitdiff
path: root/mysql-test/t/innodb_mysql.test
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-05-14 23:55:18 -0700
committerunknown <igor@olga.mysql.com>2007-05-14 23:55:18 -0700
commit8762539d477d949a5bd4c2df8b03b28727e5ee98 (patch)
tree9162cae8999cffd73ac55adf27e69a38fd310701 /mysql-test/t/innodb_mysql.test
parentfca58c95566c5a7bf8abf7386aa2b03890d85e05 (diff)
downloadmariadb-git-8762539d477d949a5bd4c2df8b03b28727e5ee98.tar.gz
Fixed bug #28272: crash that occurs when running an EXPLAIN command
for a query over an empty table right after its creation. The crash is the result of an attempt made by JOIN::optimize to evaluate the WHERE condition when no records have been actually read. The added test case can reproduce the crash only with InnoDB tables and only with 5.0.x. mysql-test/r/innodb_mysql.result: Added a test case for bug #28272. mysql-test/t/innodb_mysql.test: Added a test case for bug #28272. sql/sql_select.cc: Fixed bug #28272: crash that occurs when running an EXPLAIN command for a query over an empty table right after its creation. The crash is the result of an attempt made by JOIN::optimize to evaluate the WHERE condition when no records have been actually read. Such attempts could be observed only with EXPLAIN commands. Now at the optimization phase the WHERE condition is never evaluated if there is no record previously read from the table.
Diffstat (limited to 'mysql-test/t/innodb_mysql.test')
-rw-r--r--mysql-test/t/innodb_mysql.test25
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index 0973385dc5b..b5e7fc6e405 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -191,4 +191,29 @@ INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
SELECT * FROM t1;
DROP TABLE t1;
+#
+# Bug #28272: EXPLAIN for SELECT from an empty InnoDB table
+#
+
+CREATE TABLE t1 (
+ a1 decimal(10,0) DEFAULT NULL,
+ a2 blob,
+ a3 time DEFAULT NULL,
+ a4 blob,
+ a5 char(175) DEFAULT NULL,
+ a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ a7 tinyblob,
+ INDEX idx (a6,a7(239),a5)
+) ENGINE=InnoDB;
+
+EXPLAIN SELECT a4 FROM t1 WHERE
+a6=NULL AND
+a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';
+
+EXPLAIN SELECT t1.a4 FROM t1, t1 t WHERE
+t.a6=t.a6 AND t1.a6=NULL AND
+t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';
+
+DROP TABLE t1;
+
--echo End of 4.1 tests