diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/ps.result | 21 | ||||
-rw-r--r-- | mysql-test/t/ps.test | 23 |
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 |