summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2006-12-12 11:53:09 -0800
committerunknown <igor@olga.mysql.com>2006-12-12 11:53:09 -0800
commit22192d083ace932c5ee2c29b550012648ebf245e (patch)
tree68fa80dd5079e1ad36b1d2265cf1e000ebcd53fc /sql/item_subselect.cc
parent4108725364e4271ceedea644875e1abac00c2dc4 (diff)
parent33446269e18d0506802ca89df30f89e3e5978154 (diff)
downloadmariadb-git-22192d083ace932c5ee2c29b550012648ebf245e.tar.gz
Merge olga.mysql.com:/home/igor/mysql-4.1-opt
into olga.mysql.com:/home/igor/mysql-5.0-opt sql/item_subselect.cc: Auto merged mysql-test/r/subselect.result: Manual merge mysql-test/t/subselect.test: Manual merge sql/item_subselect.h: Manual merge
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 bffecb3c84c..4910fff4c4e 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -349,6 +349,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
@@ -373,8 +374,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;
@@ -2278,6 +2277,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