summaryrefslogtreecommitdiff
path: root/mysql-test/t/ps.test
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2010-09-23 10:43:51 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2010-09-23 10:43:51 +0400
commit89da1a7ca754672087dbd62009731581f095bdfc (patch)
tree44c8ade41cf4898d56f5004e09797e427b93c963 /mysql-test/t/ps.test
parent647cea445e05cff32847ff3c7b12247cdbd881ac (diff)
downloadmariadb-git-89da1a7ca754672087dbd62009731581f095bdfc.tar.gz
Bug#54494 crash with explain extended and prepared statements
In case of outer join and emtpy WHERE conditon 'always true' condition is created for WHERE clasue. Later in mysql_select() original SELECT_LEX WHERE condition is overwritten with created cond. However SELECT_LEX condition is also used as inital condition in mysql_select()->JOIN::prepare(). On second execution of PS modified SELECT_LEX condition is taken and it leads to crash. The fix is to restore original SELECT_LEX condition (set to NULL if original cond is NULL) in reinit_stmt_before_use(). HAVING clause is fixed too for safety reason (no test case as I did not manage to think out appropriate example). mysql-test/r/ps.result: test case mysql-test/t/ps.test: test case sql/sql_prepare.cc: restore original SELECT_LEX condition (set to NULL if original cond is NULL) in reinit_stmt_before_use()
Diffstat (limited to 'mysql-test/t/ps.test')
-rw-r--r--mysql-test/t/ps.test11
1 files changed, 11 insertions, 0 deletions
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 4390b70e9e9..036c8404095 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3079,4 +3079,15 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
+--echo #
+--echo # Bug#54494 crash with explain extended and prepared statements
+--echo #
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1),(2);
+PREPARE stmt FROM 'EXPLAIN EXTENDED SELECT 1 FROM t1 RIGHT JOIN t1 t2 ON 1';
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
--echo End of 5.1 tests.