summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-09-10 13:09:27 +0300
committerunknown <bell@sanja.is.com.ua>2004-09-10 13:09:27 +0300
commit76001900fd1a13a4dba02472cbbda0f04214db34 (patch)
tree9560974673aa614e7656f2485096c20b9d315d73
parentf3d4db99c3c9d53f3910d6534c6a6b7c3ca871db (diff)
downloadmariadb-git-76001900fd1a13a4dba02472cbbda0f04214db34.tar.gz
thd pointer fixed
BitKeeper/etc/ignore: Added libmysqld/sql_trigger.cc to the ignore list mysql-test/r/merge.result: fix of test
-rw-r--r--.bzrignore1
-rw-r--r--mysql-test/r/merge.result2
-rw-r--r--sql/item_subselect.cc15
-rw-r--r--sql/item_subselect.h2
4 files changed, 16 insertions, 4 deletions
diff --git a/.bzrignore b/.bzrignore
index be7211af9e2..2ab7737922f 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -919,3 +919,4 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
+libmysqld/sql_trigger.cc
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 5755033190b..7334d5acf4d 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -650,4 +650,6 @@ create table t3 engine=merge union=(t1, t2) select * from t1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause
create table t3 engine=merge union=(t1, t2) select * from t2;
ERROR HY000: You can't specify target table 't2' for update in FROM clause
+create table t3 engine=merge union=(t1, t2) select (select max(a) from t2);
+ERROR HY000: You can't specify target table 't2' for update in FROM clause
drop table t1, t2;
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 9cd01255d43..25bb2701101 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -272,7 +272,8 @@ Item_singlerow_subselect::Item_singlerow_subselect(st_select_lex *select_lex)
DBUG_VOID_RETURN;
}
-Item_maxmin_subselect::Item_maxmin_subselect(Item_subselect *parent,
+Item_maxmin_subselect::Item_maxmin_subselect(THD *thd_param,
+ Item_subselect *parent,
st_select_lex *select_lex,
bool max_arg)
:Item_singlerow_subselect()
@@ -291,6 +292,12 @@ Item_maxmin_subselect::Item_maxmin_subselect(Item_subselect *parent,
used_tables_cache= parent->get_used_tables_cache();
const_item_cache= parent->get_const_item_cache();
+ /*
+ this subquery alwais creates during preparation, so we can assign
+ thd here
+ */
+ thd= thd_param;
+
DBUG_VOID_RETURN;
}
@@ -316,6 +323,8 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
SELECT_LEX *select_lex= join->select_lex;
/* Juggle with current arena only if we're in prepared statement prepare */
+ DBUG_PRINT("TANSF:", ("thd %p, select_lex->join->thd: %s",
+ thd, select_lex->join->thd));
Item_arena *arena= thd->current_arena;
Item_arena backup;
if (arena->is_conventional())
@@ -723,7 +732,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
// remove LIMIT placed by ALL/ANY subquery
select_lex->master_unit()->global_parameters->select_limit=
HA_POS_ERROR;
- subs= new Item_maxmin_subselect(this, select_lex, func->l_op());
+ subs= new Item_maxmin_subselect(thd, this, select_lex, func->l_op());
}
// left expression belong to outer select
SELECT_LEX *current= thd->lex->current_select, *up;
@@ -899,7 +908,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
}
thd->where= "row IN/ALL/ANY subquery";
- Item_arena *arena= join->thd->current_arena, backup;
+ Item_arena *arena= thd->current_arena, backup;
if (arena->is_conventional())
arena= 0;
else
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index ed3dbfa9855..4ef680cea19 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -154,7 +154,7 @@ class Item_maxmin_subselect :public Item_singlerow_subselect
{
bool max;
public:
- Item_maxmin_subselect(Item_subselect *parent,
+ Item_maxmin_subselect(THD *thd, Item_subselect *parent,
st_select_lex *select_lex, bool max);
void print(String *str);
};