diff options
author | aelkin@mysql.com <> | 2006-05-07 11:43:27 +0300 |
---|---|---|
committer | aelkin@mysql.com <> | 2006-05-07 11:43:27 +0300 |
commit | 7dcd1383a8e8e293ec80fd654ec060fa997d76f0 (patch) | |
tree | 2a1eb50a7515b64e33a9078c7e6a5c2f73f9fb9b | |
parent | ceef1105b258fe23745ca5d04ad60951ad21bd8b (diff) | |
parent | 8c57924a6a45530b2cdcdb96031c16f3ee5ffc7c (diff) | |
download | mariadb-git-7dcd1383a8e8e293ec80fd654ec060fa997d76f0.tar.gz |
Merge mysql.com:/usr_rh9/home/elkin.rh9/MySQL/BARE/4.1
into mysql.com:/usr_rh9/home/elkin.rh9/MySQL/FIXES/4.1-bug19136_unass_user_var
-rw-r--r-- | mysql-test/r/rpl_user_variables.result | 1 | ||||
-rw-r--r-- | mysql-test/t/rpl_user_variables.test | 6 | ||||
-rw-r--r-- | sql/item_func.cc | 10 |
3 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/r/rpl_user_variables.result b/mysql-test/r/rpl_user_variables.result index 85768270ba3..8af2c3e0b22 100644 --- a/mysql-test/r/rpl_user_variables.result +++ b/mysql-test/r/rpl_user_variables.result @@ -105,5 +105,6 @@ slave-bin.000001 1370 User var 2 1370 @`a`=5 slave-bin.000001 1412 Query 1 1412 use `test`; insert into t1 values (@a),(@a) slave-bin.000001 1478 User var 2 1478 @`a`=NULL slave-bin.000001 1503 Query 1 1503 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; stop slave; diff --git a/mysql-test/t/rpl_user_variables.test b/mysql-test/t/rpl_user_variables.test index 5cf502e05bd..6597413c22e 100644 --- a/mysql-test/t/rpl_user_variables.test +++ b/mysql-test/t/rpl_user_variables.test @@ -47,9 +47,15 @@ connection slave; sync_with_master; select * from t1; show binlog events from 141; + +# +# BUG19136: Crashing log-bin and uninitialized user variables in a derived table +# just to check nothing bad happens anymore connection master; +insert into t1 select * FROM (select @var1 union select @var2) AS t2; drop table t1; save_master_pos; + connection slave; sync_with_master; stop slave; diff --git a/sql/item_func.cc b/sql/item_func.cc index 1f170242113..66300d129d4 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2735,14 +2735,24 @@ int get_var_with_binlog(THD *thd, LEX_STRING &name, sql_set_variables(), we could instead manually call check() and update(); this would save memory and time; but calling sql_set_variables() makes 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; + 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, new Item_null()))); /* Create the variable */ if (sql_set_variables(thd, &tmp_var_list)) + { + thd->lex= sav_lex; goto err; + } + thd->lex= sav_lex; if (!(var_entry= get_variable(&thd->user_vars, name, 0))) goto err; } |