summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/derived_cond_pushdown.result109
1 files changed, 109 insertions, 0 deletions
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index 0be577a9f64..fd58ee038c7 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -8241,3 +8241,112 @@ SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 );
d
DROP VIEW v1;
DROP TABLE t1,t2;
+#
+# MDEV-11820: second execution of PS for query
+# with false subquery predicate in WHERE
+#
+CREATE TABLE t1 (c VARCHAR(3)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('bar');
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (3), (4);
+PREPARE stmt1 FROM
+" SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'";
+PREPARE stmt2 FROM
+"EXPLAIN FORMAT=JSON
+ SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'";
+EXECUTE stmt1;
+c
+foo
+EXECUTE stmt2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c = 'foo'",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.c = 'foo'"
+ }
+ }
+ }
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "1 = t2.a"
+ }
+ }
+ }
+ ]
+ }
+}
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+INSERT INTO t2 SELECT a+1 FROM t2;
+EXECUTE stmt1;
+c
+foo
+EXECUTE stmt2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<in_optimizer>(1,<exists>(subquery#2)) or v1.c = 'foo'",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ }
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 128,
+ "filtered": 100,
+ "attached_condition": "1 = t2.a"
+ }
+ }
+ }
+ ]
+ }
+}
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DROP VIEW v1;
+DROP TABLE t1,t2;