summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
authorGeorgi Kodinov <kgeorge@mysql.com>2008-10-17 17:55:06 +0300
committerGeorgi Kodinov <kgeorge@mysql.com>2008-10-17 17:55:06 +0300
commit697b2839db05adcfe50c4f378256fccceb823633 (patch)
tree9cc59e113b7bc151b40b190f7fc2e5bb12aa8534 /mysql-test/t/sp.test
parent3ad228d7fba6fa2e5b98569f798583b8f8b90db9 (diff)
downloadmariadb-git-697b2839db05adcfe50c4f378256fccceb823633.tar.gz
Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN
fails after the first time Two separate problems : 1. When flattening joins the linked list used for name resolution (next_name_resolution_table) was not updated. Fixed by updating the pointers when extending the table list 2. The items created by expanding a * (star) as a column reference were marked as fixed, but no cached table was assigned to them (unlike what Item_field::fix_fields does). Fixed by assigning a cached table (so the re-preparation is done faster). Note that the fix for #2 hides the fix for #1 in most cases (except when a table reference cannot be cached). mysql-test/r/sp.result: Bug #33811: test case mysql-test/t/sp.test: Bug #33811: test case sql/sql_base.cc: Bug #33811: cache the table for Item_fields created by expanding '*' sql/sql_select.cc: Bug #33811: maintain a correct name resolution chain when flattening joins.
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 6d7a4b96167..d5bb565cbc8 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -7793,6 +7793,21 @@ select (select func30787(f1)) as ttt from t1;
drop function func30787;
drop table t1;
+#
+# Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN fails
+# after the first time
+#
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+
+CREATE PROCEDURE test_sp()
+ SELECT t1.* FROM t1 RIGHT JOIN t1 t2 ON t1.id=t2.id;
+
+CALL test_sp();
+CALL test_sp();
+
+DROP PROCEDURE test_sp;
+DROP TABLE t1;
#
# Bug#38291 memory corruption and server crash with view/sp/function