summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkroki/tomash@moonlight.intranet <>2006-09-29 22:30:48 +0400
committerkroki/tomash@moonlight.intranet <>2006-09-29 22:30:48 +0400
commitde7c5f1b98df6f30bcdc2659cd172062ac7c5cf8 (patch)
treef0389c945238a1d284bd7e87771fcea243f4b4fb
parent76c5979f9ed14b8e2d2856a5ff0f60630f13aa5e (diff)
parent7bfe643120eaac707baf8e8160a82f57144db325 (diff)
downloadmariadb-git-de7c5f1b98df6f30bcdc2659cd172062ac7c5cf8.tar.gz
Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0
into moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug21081
-rw-r--r--mysql-test/r/ps.result21
-rw-r--r--mysql-test/t/ps.test27
-rw-r--r--sql/item.cc1
3 files changed, 49 insertions, 0 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 080187cfa7b..059a8fe6aa2 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -1311,4 +1311,25 @@ EXECUTE stmt USING @a;
i j i i j
DEALLOCATE PREPARE stmt;
DROP TABLE IF EXISTS t1, t2, t3;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (i INT KEY);
+CREATE TABLE t2 (i INT);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1);
+PREPARE stmt FROM "SELECT t2.i FROM t1 LEFT JOIN t2 ON t2.i = t1.i
+ WHERE t1.i = ?";
+SET @arg= 1;
+EXECUTE stmt USING @arg;
+i
+1
+SET @arg= 2;
+EXECUTE stmt USING @arg;
+i
+NULL
+SET @arg= 1;
+EXECUTE stmt USING @arg;
+i
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
End of 5.0 tests.
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 5b2e37ecc94..692db191cf7 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1358,4 +1358,31 @@ DEALLOCATE PREPARE stmt;
DROP TABLE IF EXISTS t1, t2, t3;
+#
+# BUG#21081: SELECT inside stored procedure returns wrong results
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (i INT KEY);
+CREATE TABLE t2 (i INT);
+
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1);
+
+PREPARE stmt FROM "SELECT t2.i FROM t1 LEFT JOIN t2 ON t2.i = t1.i
+ WHERE t1.i = ?";
+
+SET @arg= 1;
+EXECUTE stmt USING @arg;
+SET @arg= 2;
+EXECUTE stmt USING @arg;
+SET @arg= 1;
+EXECUTE stmt USING @arg;
+
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+
+
--echo End of 5.0 tests.
diff --git a/sql/item.cc b/sql/item.cc
index de78a2539a7..ba13ba985b5 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -3744,6 +3744,7 @@ void Item_field::cleanup()
I.e. we can drop 'field'.
*/
field= result_field= 0;
+ null_value= FALSE;
DBUG_VOID_RETURN;
}