summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-07-29 16:59:46 +0300
committerunknown <bell@sanja.is.com.ua>2003-07-29 16:59:46 +0300
commit668cd9729f8f1a35ebd6eb95bec9b612b7596f16 (patch)
treeef3b1992b411c5c86aad5ca070b0b671eb241487 /mysql-test
parent8713e9791ce79bd8f4e939c4c8e420809cd7832b (diff)
downloadmariadb-git-668cd9729f8f1a35ebd6eb95bec9b612b7596f16.tar.gz
prevented finding references in item_list for non-SELECT st_select_lex
(fixed BUG#943) mysql-test/r/subselect.result: test for bug 943 mysql-test/t/subselect.test: test for bug 943 sql/item.cc: bool field changed with enum prevented finding references in item_list for non-SELECT st_select_lex sql/sql_lex.cc: bool field changed with enum sql/sql_lex.h: bool field changed with enum sql/sql_parse.cc: all subqueries and UNION parts marked as SELECT sql/sql_yacc.yy: bool field changed with enum PRIMARY SELECT command st_select_lex marked as SELECT
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/subselect.result7
-rw-r--r--mysql-test/t/subselect.test15
2 files changed, 21 insertions, 1 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index bba86ff8891..7e07371c103 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1225,3 +1225,10 @@ a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 an
2 2
1 2
drop table t1,t2,t3;
+create table t1 (s1 int);
+create table t2 (s1 int);
+insert into t1 values (1);
+insert into t2 values (1);
+update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
+ERROR 42S02: Unknown table 'x' in field list
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 66d8dd2bc32..874bd008f94 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -817,4 +817,17 @@ insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
insert into t3 values (3,3), (2,2), (1,1);
select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
-drop table t1,t2,t3;s
+drop table t1,t2,t3;
+
+#
+# update subquery with wrong field (to force name resolving
+# in UPDATE name space)
+#
+create table t1 (s1 int);
+create table t2 (s1 int);
+insert into t1 values (1);
+insert into t2 values (1);
+-- error 1109
+update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
+DROP TABLE t1, t2;
+