diff options
author | Georgi Kodinov <joro@sun.com> | 2009-07-16 16:17:47 +0300 |
---|---|---|
committer | Georgi Kodinov <joro@sun.com> | 2009-07-16 16:17:47 +0300 |
commit | 760efb518898c7dc540b439a79da36ac25bf5a37 (patch) | |
tree | a952ce92279ef0fe826cca74e68f5a116d23672d /sql | |
parent | 73f2c6484161ab7d060b1f6c661642f586afdd60 (diff) | |
parent | 1a4bc9a1e429697f86f63f2599e49a4f2d29cd32 (diff) | |
download | mariadb-git-760efb518898c7dc540b439a79da36ac25bf5a37.tar.gz |
automerge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_base.cc | 8 | ||||
-rw-r--r-- | sql/sql_select.cc | 24 | ||||
-rw-r--r-- | sql/sql_select.h | 3 |
3 files changed, 26 insertions, 9 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 88e1620b152..b81070000b3 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -7375,7 +7375,13 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields, /* make * substituting permanent */ SELECT_LEX *select_lex= thd->lex->current_select; select_lex->with_wild= 0; - select_lex->item_list= fields; + /* + The assignment below is translated to memcpy() call (at least on some + platforms). memcpy() expects that source and destination areas do not + overlap. That problem was detected by valgrind. + */ + if (&select_lex->item_list != &fields) + select_lex->item_list= fields; thd->restore_active_arena(arena, &backup); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 401745bd9b8..28909bbb911 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1807,7 +1807,8 @@ JOIN::exec() curr_join->having= curr_join->tmp_having= 0; // Allready done /* Change sum_fields reference to calculated fields in tmp_table */ - curr_join->all_fields= *curr_all_fields; + if (curr_join != this) + curr_join->all_fields= *curr_all_fields; if (!items1) { items1= items0 + all_fields.elements; @@ -1826,8 +1827,11 @@ JOIN::exec() fields_list.elements, all_fields)) DBUG_VOID_RETURN; } - curr_join->tmp_all_fields1= tmp_all_fields1; - curr_join->tmp_fields_list1= tmp_fields_list1; + if (curr_join != this) + { + curr_join->tmp_all_fields1= tmp_all_fields1; + curr_join->tmp_fields_list1= tmp_fields_list1; + } curr_join->items1= items1; } curr_all_fields= &tmp_all_fields1; @@ -1975,8 +1979,11 @@ JOIN::exec() tmp_fields_list2, tmp_all_fields2, fields_list.elements, tmp_all_fields1)) DBUG_VOID_RETURN; - curr_join->tmp_fields_list2= tmp_fields_list2; - curr_join->tmp_all_fields2= tmp_all_fields2; + if (curr_join != this) + { + curr_join->tmp_fields_list2= tmp_fields_list2; + curr_join->tmp_all_fields2= tmp_all_fields2; + } } curr_fields_list= &curr_join->tmp_fields_list2; curr_all_fields= &curr_join->tmp_all_fields2; @@ -2031,8 +2038,11 @@ JOIN::exec() tmp_table_param.save_copy_field= curr_join->tmp_table_param.copy_field; tmp_table_param.save_copy_field_end= curr_join->tmp_table_param.copy_field_end; - curr_join->tmp_all_fields3= tmp_all_fields3; - curr_join->tmp_fields_list3= tmp_fields_list3; + if (curr_join != this) + { + curr_join->tmp_all_fields3= tmp_all_fields3; + curr_join->tmp_fields_list3= tmp_fields_list3; + } } else { diff --git a/sql/sql_select.h b/sql/sql_select.h index 353c2b1d610..a0366d47149 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -466,7 +466,8 @@ public: group_optimized_away= 0; all_fields= fields_arg; - fields_list= fields_arg; + if (&fields_list != &fields_arg) /* Avoid valgrind-warning */ + fields_list= fields_arg; bzero((char*) &keyuse,sizeof(keyuse)); tmp_table_param.init(); tmp_table_param.end_write_records= HA_POS_ERROR; |