summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
authorkroki/tomash@moonlight.intranet <>2006-09-07 18:51:00 +0400
committerkroki/tomash@moonlight.intranet <>2006-09-07 18:51:00 +0400
commit7abe938dfa77911e55bb54f076994a780db0a2f5 (patch)
treee0132a61a13a83836bb9c131ca02708e3634ecf7 /mysql-test/t/sp.test
parent1a7cb4153cc5d737d93c53fef9700ac9d5629584 (diff)
downloadmariadb-git-7abe938dfa77911e55bb54f076994a780db0a2f5.tar.gz
BUG#20492: Subsequent calls to stored procedure yield incorrect result
if join is used For procedures with selects that use complicated joins with ON expression re-execution could erroneously ignore this ON expression, giving incorrect result. The problem was that optimized ON expression wasn't saved for re-execution. The solution is to properly save it.
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test41
1 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 4b0f463a9e3..b355829d7c7 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -6322,6 +6322,47 @@ create procedure bug21416() show create procedure bug21416|
call bug21416()|
drop procedure bug21416|
+
+#
+# BUG#20492: Subsequent calls to stored procedure yeild incorrect
+# result if join is used
+#
+# Optimized ON expression in join wasn't properly saved for reuse.
+#
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1|
+DROP VIEW IF EXISTS v1, v2|
+DROP TABLE IF EXISTS t3, t4|
+--enable_warnings
+
+CREATE TABLE t3 (t3_id INT)|
+
+INSERT INTO t3 VALUES (0)|
+INSERT INTO t3 VALUES (1)|
+
+CREATE TABLE t4 (t4_id INT)|
+
+INSERT INTO t4 VALUES (2)|
+
+CREATE VIEW v1 AS
+SELECT t3.t3_id, t4.t4_id
+FROM t3 JOIN t4 ON t3.t3_id = 0|
+
+CREATE VIEW v2 AS
+SELECT t3.t3_id AS t3_id_1, v1.t3_id AS t3_id_2, v1.t4_id
+FROM t3 LEFT JOIN v1 ON t3.t3_id = 0|
+
+CREATE PROCEDURE p1() SELECT * FROM v2|
+
+# Results should not differ.
+CALL p1()|
+CALL p1()|
+
+DROP PROCEDURE p1|
+DROP VIEW v1, v2|
+DROP TABLE t3, t4|
+
+
#
# BUG#NNNN: New bug synopsis
#