summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2014-01-28 23:23:14 +0200
committerunknown <sanja@montyprogram.com>2014-01-28 23:23:14 +0200
commit08293a35e663f79a95b9e6c719bd45b7c5870d57 (patch)
tree4a8e0ca77bc65b6722dcdcba5f941f5f034ecb21 /mysql-test
parent52340eee1a97165af937eb5db0b07ed00163a55e (diff)
downloadmariadb-git-08293a35e663f79a95b9e6c719bd45b7c5870d57.tar.gz
MDEV-5369: Wrong result (0 instead of NULL) on 2nd execution of PS with LEFT JOIN, TEMPTABLE view
Set of JOIN_TYPE_OUTER made only once to avoid interference with optimization joins which made only once per query.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/ps.result21
-rw-r--r--mysql-test/t/ps.test23
2 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index e5411b2a210..539845c9e50 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -3307,4 +3307,25 @@ c1
NULL
2
DROP TABLE t1,t2;
+#
+# MDEV-5369: Wrong result (0 instead of NULL) on 2nd execution of
+# PS with LEFT JOIN, TEMPTABLE view
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (0),(8);
+CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM;
+CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
+SELECT SUM(pk) FROM t1 LEFT JOIN v2 ON a = pk;
+SUM(pk)
+NULL
+PREPARE stmt FROM "SELECT SUM(pk) FROM t1 LEFT JOIN v2 ON a = pk";
+EXECUTE stmt;
+SUM(pk)
+NULL
+EXECUTE stmt;
+SUM(pk)
+NULL
+DEALLOCATE PREPARE stmt;
+DROP VIEW v2;
+DROP TABLE t1, t2;
# End of 5.3 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 4d7c6848da7..ae9a0fb326c 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3330,4 +3330,27 @@ EXECUTE stmt;
DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-5369: Wrong result (0 instead of NULL) on 2nd execution of
+--echo # PS with LEFT JOIN, TEMPTABLE view
+--echo #
+
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (0),(8);
+
+CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM;
+CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
+
+SELECT SUM(pk) FROM t1 LEFT JOIN v2 ON a = pk;
+
+PREPARE stmt FROM "SELECT SUM(pk) FROM t1 LEFT JOIN v2 ON a = pk";
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+DROP VIEW v2;
+DROP TABLE t1, t2;
+
--echo # End of 5.3 tests