Commit e6d02a12 authored by Mattias Jonsson's avatar Mattias Jonsson

merge

parents c4584fc6 b35feb1e
...@@ -2045,10 +2045,15 @@ DROP TABLE t1; ...@@ -2045,10 +2045,15 @@ DROP TABLE t1;
# #
# Bug #45807: crash accessing partitioned table and sql_mode # Bug #45807: crash accessing partitioned table and sql_mode
# contains ONLY_FULL_GROUP_BY # contains ONLY_FULL_GROUP_BY
# Bug#46923: select count(*) from partitioned table fails with
# ONLY_FULL_GROUP_BY
# #
SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY'; SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY';
CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM
PARTITION BY HASH(id) PARTITIONS 2; PARTITION BY HASH(id) PARTITIONS 2;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1; DROP TABLE t1;
SET SESSION SQL_MODE=DEFAULT; SET SESSION SQL_MODE=DEFAULT;
# #
......
...@@ -2031,11 +2031,14 @@ DROP TABLE t1; ...@@ -2031,11 +2031,14 @@ DROP TABLE t1;
--echo # --echo #
--echo # Bug #45807: crash accessing partitioned table and sql_mode --echo # Bug #45807: crash accessing partitioned table and sql_mode
--echo # contains ONLY_FULL_GROUP_BY --echo # contains ONLY_FULL_GROUP_BY
--echo # Bug#46923: select count(*) from partitioned table fails with
--echo # ONLY_FULL_GROUP_BY
--echo # --echo #
SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY'; SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY';
CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM
PARTITION BY HASH(id) PARTITIONS 2; PARTITION BY HASH(id) PARTITIONS 2;
SELECT COUNT(*) FROM t1;
DROP TABLE t1; DROP TABLE t1;
SET SESSION SQL_MODE=DEFAULT; SET SESSION SQL_MODE=DEFAULT;
......
...@@ -905,6 +905,8 @@ bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table, ...@@ -905,6 +905,8 @@ bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
char* db_name; char* db_name;
char db_name_string[FN_REFLEN]; char db_name_string[FN_REFLEN];
bool save_use_only_table_context; bool save_use_only_table_context;
uint8 saved_full_group_by_flag;
nesting_map saved_allow_sum_func;
DBUG_ENTER("fix_fields_part_func"); DBUG_ENTER("fix_fields_part_func");
if (part_info->fixed) if (part_info->fixed)
...@@ -974,9 +976,19 @@ bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table, ...@@ -974,9 +976,19 @@ bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
save_use_only_table_context= thd->lex->use_only_table_context; save_use_only_table_context= thd->lex->use_only_table_context;
thd->lex->use_only_table_context= TRUE; thd->lex->use_only_table_context= TRUE;
thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS; thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS;
saved_full_group_by_flag= thd->lex->current_select->full_group_by_flag;
saved_allow_sum_func= thd->lex->allow_sum_func;
thd->lex->allow_sum_func= 0;
error= func_expr->fix_fields(thd, (Item**)&func_expr); error= func_expr->fix_fields(thd, (Item**)&func_expr);
/*
Restore full_group_by_flag and allow_sum_func,
fix_fields should not affect mysql_select later, see Bug#46923.
*/
thd->lex->current_select->full_group_by_flag= saved_full_group_by_flag;
thd->lex->allow_sum_func= saved_allow_sum_func;
thd->lex->use_only_table_context= save_use_only_table_context; thd->lex->use_only_table_context= save_use_only_table_context;
context->table_list= save_table_list; context->table_list= save_table_list;
......
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