summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2009-12-22 10:39:29 +0400
committerRamil Kalimullin <ramil@mysql.com>2009-12-22 10:39:29 +0400
commit7344b58c32c07df496c208dad5c1e11c304e8aac (patch)
tree733281e6b6140baf7c2739371a0778ceec9c9dde /mysql-test
parent007d77afb9ea5fd7b7a369114f8963ab147fd2c5 (diff)
downloadmariadb-git-7344b58c32c07df496c208dad5c1e11c304e8aac.tar.gz
Fix for bug#49570: Assertion failed: !(order->used & map)
on re-execution of prepared statement Problem: some (see eq_ref_table()) ORDER BY/GROUP BY optimization is called before each PS execution. However, we don't properly initialize its stucture every time before the call. Fix: properly initialize the sturture used. mysql-test/r/ps.result: Fix for bug#49570: Assertion failed: !(order->used & map) on re-execution of prepared statement - test result. mysql-test/t/ps.test: Fix for bug#49570: Assertion failed: !(order->used & map) on re-execution of prepared statement - test case. sql/sql_select.cc: Fix for bug#49570: Assertion failed: !(order->used & map) on re-execution of prepared statement - set order->used to 0 before each eq_ref_table() call, as the function relies on that.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/ps.result22
-rw-r--r--mysql-test/t/ps.test16
2 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 8a19b9b17e1..6e017ec7253 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -1916,4 +1916,26 @@ execute stmt;
deallocate prepare stmt;
drop table t1,t2;
#
+#
+# Bug #49570: Assertion failed: !(order->used & map)
+# on re-execution of prepared statement
+#
+CREATE TABLE t1(a INT PRIMARY KEY);
+INSERT INTO t1 VALUES(0), (1);
+PREPARE stmt FROM
+"SELECT 1 FROM t1 JOIN t1 t2 USING(a) GROUP BY t2.a, t1.a";
+EXECUTE stmt;
+1
+1
+1
+EXECUTE stmt;
+1
+1
+1
+EXECUTE stmt;
+1
+1
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
End of 5.0 tests.
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 8f8e943913f..e207b0f154a 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1996,4 +1996,20 @@ deallocate prepare stmt;
drop table t1,t2;
--echo #
+
+--echo #
+--echo # Bug #49570: Assertion failed: !(order->used & map)
+--echo # on re-execution of prepared statement
+--echo #
+CREATE TABLE t1(a INT PRIMARY KEY);
+INSERT INTO t1 VALUES(0), (1);
+PREPARE stmt FROM
+ "SELECT 1 FROM t1 JOIN t1 t2 USING(a) GROUP BY t2.a, t1.a";
+EXECUTE stmt;
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
+
--echo End of 5.0 tests.