summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-01-03 11:13:01 +0400
committerunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-01-03 11:13:01 +0400
commit6a4fbf09bec454762c09afd33e264d1a7999597e (patch)
tree67158e1231a13e0031e1b313303882ddd6a05ba4 /sql/item_subselect.cc
parent42a7506d288a7666b666f9b514e7bbb2b1dc88dd (diff)
parent4c737cf1428c4b08bafd9888b86c8aed6002380b (diff)
downloadmariadb-git-6a4fbf09bec454762c09afd33e264d1a7999597e.tar.gz
Merge mysql.com:/d2/hf/common/my50-common
into mysql.com:/d2/hf/opt/my50-opt myisam/mi_check.c: Auto merged sql/item_subselect.cc: Auto merged sql/item_subselect.h: Auto merged sql/sql_lex.cc: Auto merged sql/sql_udf.cc: Auto merged
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 28aaf41b39f..d5d26b7b741 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -348,6 +348,7 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
*/
!(select_lex->item_list.head()->type() == FIELD_ITEM ||
select_lex->item_list.head()->type() == REF_ITEM) &&
+ !join->conds && !join->having &&
/*
switch off this optimization for prepare statement,
because we do not rollback this changes
@@ -372,8 +373,6 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
*/
substitution->walk(&Item::remove_dependence_processor,
(byte *) select_lex->outer_select());
- /* SELECT without FROM clause can't have WHERE or HAVING clause */
- DBUG_ASSERT(join->conds == 0 && join->having == 0);
return RES_REDUCE;
}
return RES_OK;
@@ -2277,6 +2276,22 @@ bool subselect_single_select_engine::no_tables()
/*
+ Check statically whether the subquery can return NULL
+
+ SINOPSYS
+ subselect_single_select_engine::may_be_null()
+
+ RETURN
+ FALSE can guarantee that the subquery never return NULL
+ TRUE otherwise
+*/
+bool subselect_single_select_engine::may_be_null()
+{
+ return ((no_tables() && !join->conds && !join->having) ? maybe_null : 1);
+}
+
+
+/*
Report about presence of tables in subquery
SYNOPSIS