summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2009-09-04 13:14:54 +0500
committerRamil Kalimullin <ramil@mysql.com>2009-09-04 13:14:54 +0500
commit2a6ac469fc7cd940d7864babafb72798b7643bf3 (patch)
tree9f25a8bd7bbbbd076306fa4f6d7063979f0325fd /mysql-test/t/sp.test
parent1eb40ce319411cf0f06a6115210b5475593cef7f (diff)
downloadmariadb-git-2a6ac469fc7cd940d7864babafb72798b7643bf3.tar.gz
Fix for bug#46629: Item_in_subselect::val_int(): Assertion `0'
on subquery inside a SP Problem: repeated call of a SP containing an incorrect query with a subselect may lead to failed ASSERT(). Fix: set proper sublelect's state in case of error occured during subquery transformation. mysql-test/r/sp.result: Fix for bug#46629: Item_in_subselect::val_int(): Assertion `0' on subquery inside a SP - test result. mysql-test/t/sp.test: Fix for bug#46629: Item_in_subselect::val_int(): Assertion `0' on subquery inside a SP - test case. sql/item_subselect.cc: Fix for bug#46629: Item_in_subselect::val_int(): Assertion `0' on subquery inside a SP - don't set Item_subselect::changed in the Item_subselect::fix_fields() if an error occured during subquery transformation. That prevents us of further processing incorrect subqueries after Item_in_subselect::select_in_like_transformer().
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 5eeac457958..44c4556340e 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -8242,6 +8242,28 @@ while ($tab_count)
DROP PROCEDURE p1;
DROP TABLE t1;
+
+--echo #
+--echo # Bug #46629: Item_in_subselect::val_int(): Assertion `0'
+--echo # on subquery inside a SP
+--echo #
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT, b INT PRIMARY KEY);
+
+DELIMITER |;
+CREATE PROCEDURE p1 ()
+BEGIN
+ SELECT a FROM t1 A WHERE A.b IN (SELECT b FROM t2 AS B);
+END|
+DELIMITER ;|
+--error ER_BAD_FIELD_ERROR
+CALL p1;
+--error ER_BAD_FIELD_ERROR
+CALL p1;
+DROP PROCEDURE p1;
+DROP TABLE t1, t2;
+
+
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------