Commit 30a7094f authored by unknown's avatar unknown

Merge rurik.mysql.com:/home/igor/dev/mysql-4.1-0

into  rurik.mysql.com:/home/igor/dev/mysql-5.0-0


mysql-test/r/having.result:
  Auto merged
mysql-test/t/having.test:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
mysql-test/r/rpl_user_variables.result:
  Manual merge
mysql-test/t/rpl_user_variables.test:
  Manual merge
sql/sql_lex.cc:
  Manual merge
sql/sql_prepare.cc:
  Manual merge
sql/sql_select.cc:
  Manual merge
parents 5b09d7a5 e4e67d58
...@@ -76,35 +76,35 @@ abcn1n2 ...@@ -76,35 +76,35 @@ abcn1n2
NULL NULL
NULL NULL
NULL NULL
show binlog events from 98; show binlog events from 141;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.000001 # Query 1 # use `test`; create table t1(n char(30)) slave-bin.000001 141 User var 2 141 @`i1`=12345678901234
slave-bin.000001 # User var 2 # @`i1`=12345678901234 slave-bin.000001 184 User var 2 184 @`i2`=-12345678901234
slave-bin.000001 # User var 2 # @`i2`=-12345678901234 slave-bin.000001 227 User var 2 227 @`i3`=0
slave-bin.000001 # User var 2 # @`i3`=0 slave-bin.000001 270 User var 2 270 @`i4`=-1
slave-bin.000001 # User var 2 # @`i4`=-1 slave-bin.000001 313 Query 1 313 use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4) slave-bin.000001 396 User var 2 396 @`r1`=12.5
slave-bin.000001 # User var 2 # @`r1`=12.5 slave-bin.000001 439 User var 2 439 @`r2`=-12.5
slave-bin.000001 # User var 2 # @`r2`=-12.5 slave-bin.000001 482 Query 1 482 use `test`; insert into t1 values (@r1), (@r2)
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@r1), (@r2) slave-bin.000001 551 User var 2 551 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
slave-bin.000001 # User var 2 # @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci slave-bin.000001 600 User var 2 600 @`s2`=_latin1 "" COLLATE latin1_swedish_ci
slave-bin.000001 # User var 2 # @`s2`=_latin1 "" COLLATE latin1_swedish_ci slave-bin.000001 635 User var 2 635 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 # User var 2 # @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci slave-bin.000001 677 User var 2 677 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
slave-bin.000001 # User var 2 # @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci slave-bin.000001 719 User var 2 719 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 # User var 2 # @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci slave-bin.000001 761 Query 1 761 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5) slave-bin.000001 851 User var 2 851 @`n1`=NULL
slave-bin.000001 # User var 2 # @`n1`=NULL slave-bin.000001 877 Query 1 877 use `test`; insert into t1 values (@n1)
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@n1) slave-bin.000001 939 User var 2 939 @`n2`=NULL
slave-bin.000001 # User var 2 # @`n2`=NULL slave-bin.000001 965 Query 1 965 use `test`; insert into t1 values (@n2)
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@n2) slave-bin.000001 1027 Query 1 1027 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1) slave-bin.000001 1115 User var 2 1115 @`a`=2
slave-bin.000001 # User var 2 # @`a`=2 slave-bin.000001 1157 Query 1 1157 use `test`; insert into t1 values (@a+(@b:=@a+1))
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@a+(@b:=@a+1)) slave-bin.000001 1229 User var 2 1229 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
slave-bin.000001 # User var 2 # @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci slave-bin.000001 1266 Query 1 1266 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
slave-bin.000001 # Query 1 # use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2')) slave-bin.000001 1370 User var 2 1370 @`a`=5
slave-bin.000001 # User var 2 # @`a`=5 slave-bin.000001 1412 Query 1 1412 use `test`; insert into t1 values (@a),(@a)
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@a),(@a) slave-bin.000001 1478 User var 2 1478 @`a`=NULL
slave-bin.000001 # User var 2 # @`a`=NULL slave-bin.000001 1503 Query 1 1503 use `test`; insert into t1 values (@a),(@a),(@a*5)
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@a),(@a),(@a*5) insert into t1 select * FROM (select @var1 union select @var2) AS t2;
drop table t1; drop table t1;
stop slave; stop slave;
...@@ -48,9 +48,15 @@ sync_with_master; ...@@ -48,9 +48,15 @@ sync_with_master;
select * from t1; select * from t1;
--replace_column 2 # 5 # --replace_column 2 # 5 #
show binlog events from 98; show binlog events from 98;
#
# BUG19136: Crashing log-bin and uninitialized user variables in a derived table
# just to check nothing bad happens anymore
connection master; connection master;
insert into t1 select * FROM (select @var1 union select @var2) AS t2;
drop table t1; drop table t1;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
stop slave; stop slave;
......
...@@ -3946,14 +3946,24 @@ int get_var_with_binlog(THD *thd, enum_sql_command sql_command, ...@@ -3946,14 +3946,24 @@ int get_var_with_binlog(THD *thd, enum_sql_command sql_command,
sql_set_variables(), we could instead manually call check() and update(); sql_set_variables(), we could instead manually call check() and update();
this would save memory and time; but calling sql_set_variables() makes this would save memory and time; but calling sql_set_variables() makes
one unique place to maintain (sql_set_variables()). one unique place to maintain (sql_set_variables()).
Manipulation with lex is necessary since free_underlaid_joins
is going to release memory belonging to the main query.
*/ */
List<set_var_base> tmp_var_list; List<set_var_base> tmp_var_list;
LEX *sav_lex= thd->lex, lex_tmp;
thd->lex= &lex_tmp;
lex_start(thd, NULL, 0);
tmp_var_list.push_back(new set_var_user(new Item_func_set_user_var(name, tmp_var_list.push_back(new set_var_user(new Item_func_set_user_var(name,
new Item_null()))); new Item_null())));
/* Create the variable */ /* Create the variable */
if (sql_set_variables(thd, &tmp_var_list)) if (sql_set_variables(thd, &tmp_var_list))
{
thd->lex= sav_lex;
goto err; goto err;
}
thd->lex= sav_lex;
if (!(var_entry= get_variable(&thd->user_vars, name, 0))) if (!(var_entry= get_variable(&thd->user_vars, name, 0)))
goto err; goto err;
} }
......
...@@ -1145,7 +1145,7 @@ void st_select_lex::init_query() ...@@ -1145,7 +1145,7 @@ void st_select_lex::init_query()
cond_count= with_wild= 0; cond_count= with_wild= 0;
conds_processed_with_permanent_arena= 0; conds_processed_with_permanent_arena= 0;
ref_pointer_array= 0; ref_pointer_array= 0;
select_n_having_items= 0; select_n_having_items= 0;}
subquery_in_having= explicit_limit= 0; subquery_in_having= explicit_limit= 0;
is_item_list_lookup= 0; is_item_list_lookup= 0;
first_execution= 1; first_execution= 1;
......
...@@ -1965,7 +1965,6 @@ static const char *get_dynamic_sql_string(LEX *lex, uint *query_len) ...@@ -1965,7 +1965,6 @@ static const char *get_dynamic_sql_string(LEX *lex, uint *query_len)
memcpy(query_str, var_value->ptr(), var_value->length()); memcpy(query_str, var_value->ptr(), var_value->length());
query_str[len]= '\0'; // Safety (mostly for debug) query_str[len]= '\0'; // Safety (mostly for debug)
*query_len= len; *query_len= len;
}
else else
{ {
query_str= lex->prepared_stmt_code.str; query_str= lex->prepared_stmt_code.str;
...@@ -2105,7 +2104,6 @@ void reinit_stmt_before_use(THD *thd, LEX *lex) ...@@ -2105,7 +2104,6 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
/* Fix ORDER list */ /* Fix ORDER list */
for (order= (ORDER *)sl->order_list.first; order; order= order->next) for (order= (ORDER *)sl->order_list.first; order; order= order->next)
order->item= &order->item_ptr; order->item= &order->item_ptr;
}
{ {
SELECT_LEX_UNIT *unit= sl->master_unit(); SELECT_LEX_UNIT *unit= sl->master_unit();
unit->unclean(); unit->unclean();
......
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