summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2004-03-22 17:48:29 +0400
committerunknown <hf@deer.(none)>2004-03-22 17:48:29 +0400
commita0dce8c864bce640690847c5600b3d233508d4a9 (patch)
tree06fac9d666fb5aa9f7ace102bfc9090d1a49f35e
parent8aa866d94dbf2bdbd6f2fde1b705b1bfc7c7a09b (diff)
parent257d8ede4bdc58f001c62c2cdea96241a876d19b (diff)
downloadmariadb-git-a0dce8c864bce640690847c5600b3d233508d4a9.tar.gz
Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into deer.(none):/home/hf/work/mysql-4.1.clean sql/item.cc: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/t/subselect.test: Auto merged
-rw-r--r--mysql-test/r/subselect.result5
-rw-r--r--mysql-test/t/subselect.test9
-rw-r--r--sql/item.cc2
3 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 9650b7bb591..55068c4a00c 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1701,3 +1701,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1
drop table t1;
+create table t1(id int);
+create table t2(id int);
+create table t3(flag int);
+select (select * from t3 where id not null) from t1, t2;
+ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'null) from t1, t2' at line 1
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 8da67f84c86..93380f341dc 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1105,3 +1105,12 @@ create table t1 (a int);
insert into t1 values (1);
explain select benchmark(1000, (select a from t1 where a=sha(rand())));
drop table t1;
+
+#
+# bug 3188
+#
+create table t1(id int);
+create table t2(id int);
+create table t3(flag int);
+-- error 1064
+select (select * from t3 where id not null) from t1, t2;
diff --git a/sql/item.cc b/sql/item.cc
index 3df40dba5b7..faacf49fcc3 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -950,6 +950,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
table_list, &where,
0)) != not_found_field)
{
+ if (!tmp)
+ return -1;
prev_subselect_item->used_tables_cache|= tmp->table->map;
prev_subselect_item->const_item_cache= 0;
break;