diff options
author | unknown <jimw@mysql.com> | 2005-02-23 17:58:20 -0800 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-02-23 17:58:20 -0800 |
commit | a728ad71cf073b9b10080d866e904c9eaa05ab32 (patch) | |
tree | ceabc348388cb8f2c4784cebe1f57fb75adc5b47 /sql | |
parent | 8776230074184a255e8df4c5c4eb45e66fc81fe0 (diff) | |
download | mariadb-git-a728ad71cf073b9b10080d866e904c9eaa05ab32.tar.gz |
Make sure that warning message when GROUP_CONCAT() cuts values is also
updated with the correct number of lines. (Bug #8681)
mysql-test/t/join_outer.test:
Add new regression test
mysql-test/r/join_outer.result:
Add new results
sql/item_sum.cc:
Move cleanup of warning message outside of "if (original)" test or it won't
always get cleaned up.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_sum.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 6bd2cc00b3e..7e9c5d09136 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1787,16 +1787,26 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, void Item_func_group_concat::cleanup() { + THD *thd= current_thd; + DBUG_ENTER("Item_func_group_concat::cleanup"); Item_sum::cleanup(); + /* Adjust warning message to include total number of cut values */ + if (warning) + { + char warn_buff[MYSQL_ERRMSG_SIZE]; + sprintf(warn_buff, ER(ER_CUT_VALUE_GROUP_CONCAT), count_cut_values); + warning->set_msg(thd, warn_buff); + warning= 0; + } + /* Free table and tree if they belong to this item (if item have not pointer to original item from which was made copy => it own its objects ) */ if (!original) { - THD *thd= current_thd; if (table) { free_tmp_table(thd, table); @@ -1809,13 +1819,6 @@ void Item_func_group_concat::cleanup() tree_mode= 0; delete_tree(tree); } - if (warning) - { - char warn_buff[MYSQL_ERRMSG_SIZE]; - sprintf(warn_buff, ER(ER_CUT_VALUE_GROUP_CONCAT), count_cut_values); - warning->set_msg(thd, warn_buff); - warning= 0; - } } DBUG_VOID_RETURN; } @@ -2076,6 +2079,10 @@ String* Item_func_group_concat::val_str(String* str) if (null_value) return 0; if (count_cut_values && !warning) + /* + ER_CUT_VALUE_GROUP_CONCAT needs an argument, but this gets set in + Item_func_group_concat::cleanup(). + */ warning= push_warning(item_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_CUT_VALUE_GROUP_CONCAT, ER(ER_CUT_VALUE_GROUP_CONCAT)); |