summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect_exists2in.result
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2017-11-08 15:47:49 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2017-11-09 09:31:03 +0100
commitc2c93fc6e460fd32b6ef179686c2b3b2045f75eb (patch)
treee43f37d35eb5633e81cd8e9d42d55626c13ec2ed /mysql-test/r/subselect_exists2in.result
parentca695888e00a4bdace1bc2143d91a0a871f39a6b (diff)
downloadmariadb-git-c2c93fc6e460fd32b6ef179686c2b3b2045f75eb.tar.gz
MDEV-14164: Unknown column error when adding aggregate to function in oracle style procedure FOR loop
Make differentiation between pullout for merge and pulout of outer field during exists2in transformation. In last case the field was outer and so we can safely start from name resolution context of the SELECT where it was pulled. Old behavior lead to inconsistence between list of tables and outer name resolution context (which skips one SELECT for merge purposes) which creates problem vor name resolution.
Diffstat (limited to 'mysql-test/r/subselect_exists2in.result')
-rw-r--r--mysql-test/r/subselect_exists2in.result37
1 files changed, 37 insertions, 0 deletions
diff --git a/mysql-test/r/subselect_exists2in.result b/mysql-test/r/subselect_exists2in.result
index 5deb2dfa9c5..d47e446fe8f 100644
--- a/mysql-test/r/subselect_exists2in.result
+++ b/mysql-test/r/subselect_exists2in.result
@@ -934,5 +934,42 @@ f2
foo
set optimizer_switch= @optimizer_switch_save;
DROP TABLE t1;
+#
+# MDEV-14164: Unknown column error when adding aggregate to function
+# in oracle style procedure FOR loop
+#
+CREATE TABLE t1(id INT, val INT);
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE cur1 CURSOR FOR SELECT * FROM (
+SELECT DISTINCT id FROM t1) a
+WHERE NOT EXISTS (SELECT * FROM ( SELECT id FROM t1) b
+WHERE a.id=b.id);
+OPEN cur1;
+CLOSE cur1;
+OPEN cur1;
+CLOSE cur1;
+END;
+//
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
+CREATE TABLE t1(id INT, val INT);
+CREATE PROCEDURE p1()
+BEGIN
+SELECT * FROM (SELECT DISTINCT id FROM t1) a
+WHERE NOT a.id IN (SELECT b.id FROM t1 b);
+SELECT * FROM (SELECT DISTINCT id FROM t1) a
+WHERE NOT EXISTS (SELECT * FROM t1 b WHERE a.id=b.id);
+END;
+//
+CALL p1();
+id
+id
+CALL p1();
+id
+id
+DROP PROCEDURE p1;
+DROP TABLE t1;
# End of 10.0 tests
set optimizer_switch=default;