summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergey Glukhov <sergey.glukhov@oracle.com>2011-10-05 13:55:51 +0400
committerSergey Glukhov <sergey.glukhov@oracle.com>2011-10-05 13:55:51 +0400
commit7141bada7d73df8015c84c2e6b558a20f589f8d6 (patch)
tree699427bad482b67b8aedcdc1ad28bdfd6c76ec3e /sql
parent14572938232ffcd0c34a64303a6fd5d5ede1f8a9 (diff)
parent14dc91ff83001809fc40380ab22fc4e606f611de (diff)
downloadmariadb-git-7141bada7d73df8015c84c2e6b558a20f589f8d6.tar.gz
5.1 -> 5.5 merge
Diffstat (limited to 'sql')
-rw-r--r--sql/item_subselect.cc13
-rw-r--r--sql/item_subselect.h1
-rw-r--r--sql/sql_select.cc10
3 files changed, 21 insertions, 3 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index e4d3d1bd43e..0c4b96f7be0 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1690,7 +1690,7 @@ subselect_single_select_engine(st_select_lex *select,
select_subselect *result_arg,
Item_subselect *item_arg)
:subselect_engine(item_arg, result_arg),
- prepared(0), optimized(0), executed(0),
+ prepared(0), optimized(0), executed(0), optimize_error(0),
select_lex(select), join(0)
{
select_lex->master_unit()->item= item_arg;
@@ -1700,7 +1700,7 @@ subselect_single_select_engine(st_select_lex *select,
void subselect_single_select_engine::cleanup()
{
DBUG_ENTER("subselect_single_select_engine::cleanup");
- prepared= optimized= executed= 0;
+ prepared= optimized= executed= optimize_error= 0;
join= 0;
result->cleanup();
DBUG_VOID_RETURN;
@@ -1892,6 +1892,10 @@ int join_read_next_same_or_null(READ_RECORD *info);
int subselect_single_select_engine::exec()
{
DBUG_ENTER("subselect_single_select_engine::exec");
+
+ if (optimize_error)
+ DBUG_RETURN(1);
+
char const *save_where= thd->where;
SELECT_LEX *save_select= thd->lex->current_select;
thd->lex->current_select= select_lex;
@@ -1899,12 +1903,15 @@ int subselect_single_select_engine::exec()
{
SELECT_LEX_UNIT *unit= select_lex->master_unit();
+ DBUG_EXECUTE_IF("bug11747970_simulate_error",
+ DBUG_SET("+d,bug11747970_raise_error"););
+
optimized= 1;
unit->set_limit(unit->global_parameters);
if (join->optimize())
{
thd->where= save_where;
- executed= 1;
+ optimize_error= 1;
thd->lex->current_select= save_select;
DBUG_RETURN(join->error ? join->error : 1);
}
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 562eaa8a8ee..51de9bf1040 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -429,6 +429,7 @@ class subselect_single_select_engine: public subselect_engine
my_bool prepared; /* simple subselect is prepared */
my_bool optimized; /* simple subselect is optimized */
my_bool executed; /* simple subselect is executed */
+ my_bool optimize_error; ///< simple subselect optimization failed
st_select_lex *select_lex; /* corresponding select_lex */
JOIN * join; /* corresponding JOIN structure */
public:
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 35495197c2b..e67a6ebef62 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2691,6 +2691,16 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds,
table_vector[i]=s->table=table=tables->table;
table->pos_in_table_list= tables;
error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+
+ DBUG_EXECUTE_IF("bug11747970_raise_error",
+ {
+ if (!error)
+ {
+ my_error(ER_UNKNOWN_ERROR, MYF(0));
+ goto error;
+ }
+ });
+
if (error)
{
table->file->print_error(error, MYF(0));