Commit 79a184fe authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

moved links initialization

parent 5e454f6d
...@@ -24,3 +24,12 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); ...@@ -24,3 +24,12 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27; delete from t1 where a=27;
drop table t1; drop table t1;
drop table if exists t;
CREATE TABLE `t` (
`i` int(10) NOT NULL default '0',
`i2` int(10) NOT NULL default '0',
PRIMARY KEY (`i`)
) TYPE=MyISAM CHARSET=latin1;
DELETE FROM t USING t WHERE post='1';
Unknown column 'post' in 'where clause'
drop table if exists t;
...@@ -35,3 +35,13 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); ...@@ -35,3 +35,13 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27; delete from t1 where a=27;
drop table t1; drop table t1;
drop table if exists t;
CREATE TABLE `t` (
`i` int(10) NOT NULL default '0',
`i2` int(10) NOT NULL default '0',
PRIMARY KEY (`i`)
) TYPE=MyISAM CHARSET=latin1;
-- error 1054
DELETE FROM t USING t WHERE post='1';
drop table if exists t;
\ No newline at end of file
...@@ -941,8 +941,6 @@ int yylex(void *arg, void *yythd) ...@@ -941,8 +941,6 @@ int yylex(void *arg, void *yythd)
void st_select_lex_node::init_query() void st_select_lex_node::init_query()
{ {
next= master= slave= link_next= 0;
prev= link_prev= 0;
dependent= 0; dependent= 0;
} }
...@@ -1011,6 +1009,7 @@ void st_select_lex_node::include_down(st_select_lex_node *upper) ...@@ -1011,6 +1009,7 @@ void st_select_lex_node::include_down(st_select_lex_node *upper)
prev= &upper->slave; prev= &upper->slave;
upper->slave= this; upper->slave= this;
master= upper; master= upper;
slave= 0;
} }
/* include neighbour (on same level) */ /* include neighbour (on same level) */
...@@ -1021,6 +1020,7 @@ void st_select_lex_node::include_neighbour(st_select_lex_node *before) ...@@ -1021,6 +1020,7 @@ void st_select_lex_node::include_neighbour(st_select_lex_node *before)
prev= &before->next; prev= &before->next;
before->next= this; before->next= this;
master= before->master; master= before->master;
slave= 0;
} }
/* including in global SELECT_LEX list */ /* including in global SELECT_LEX list */
......
...@@ -194,6 +194,7 @@ enum olap_type ...@@ -194,6 +194,7 @@ enum olap_type
Base class for st_select_lex (SELECT_LEX) & Base class for st_select_lex (SELECT_LEX) &
st_select_lex_unit (SELECT_LEX_UNIT) st_select_lex_unit (SELECT_LEX_UNIT)
*/ */
struct st_lex;
class st_select_lex; class st_select_lex;
class st_select_lex_unit; class st_select_lex_unit;
class st_select_lex_node { class st_select_lex_node {
...@@ -252,6 +253,7 @@ public: ...@@ -252,6 +253,7 @@ public:
void mark_as_dependent(st_select_lex *last); void mark_as_dependent(st_select_lex *last);
friend class st_select_lex_unit; friend class st_select_lex_unit;
friend bool mysql_new_select(struct st_lex *lex, bool move_down);
private: private:
void fast_exclude(); void fast_exclude();
}; };
......
...@@ -2991,11 +2991,13 @@ mysql_init_query(THD *thd) ...@@ -2991,11 +2991,13 @@ mysql_init_query(THD *thd)
lex->select_lex.init_query(); lex->select_lex.init_query();
lex->value_list.empty(); lex->value_list.empty();
lex->param_list.empty(); lex->param_list.empty();
lex->unit.next= lex->unit.master= lex->unit.link_next= 0;
lex->unit.prev= lex->unit.link_prev= 0;
lex->unit.global_parameters= lex->unit.slave= lex->current_select= lex->unit.global_parameters= lex->unit.slave= lex->current_select=
lex->all_selects_list= &lex->select_lex; lex->all_selects_list= &lex->select_lex;
lex->select_lex.master= &lex->unit; lex->select_lex.master= &lex->unit;
lex->select_lex.prev= &lex->unit.slave; lex->select_lex.prev= &lex->unit.slave;
lex->select_lex.link_next= 0; lex->select_lex.link_next= lex->select_lex.slave= lex->select_lex.next= 0;
lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list); lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list);
lex->olap=lex->describe=0; lex->olap=lex->describe=0;
lex->derived_tables= false; lex->derived_tables= false;
...@@ -3045,6 +3047,8 @@ mysql_new_select(LEX *lex, bool move_down) ...@@ -3045,6 +3047,8 @@ mysql_new_select(LEX *lex, bool move_down)
unit->init_query(); unit->init_query();
unit->init_select(); unit->init_select();
unit->include_down(lex->current_select); unit->include_down(lex->current_select);
unit->link_next= 0;
unit->link_prev= 0;
select_lex->include_down(unit); select_lex->include_down(unit);
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment