diff options
author | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-10-11 17:20:34 +0500 |
---|---|---|
committer | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-10-11 17:20:34 +0500 |
commit | 24a567e9f6e73f4158eba43cf16d30ad1c8c86b4 (patch) | |
tree | bd56ef480686fc45a94c2da7c561fd283f8b0a58 /sql/item_sum.cc | |
parent | 5a6b519a2f3b6a2ac3e6375b2111cdfe43a5aff3 (diff) | |
download | mariadb-git-24a567e9f6e73f4158eba43cf16d30ad1c8c86b4.tar.gz |
Fix for bug #31154: field.h:1649: virtual int Field_bit::cmp(const uchar*, const uchar*): Assertion
Problem: GROUP_CONCAT(DISTINCT BIT_FIELD...) uses a tree to store keys;
which are constructed using a temporary table fields,
see Item_func_group_concat::setup().
As a) we don't store null bits in the tree where the bit fields store parts
of their data and b) there's no method to properly compare two table records
we've got problem.
Fix: convert BIT fields to INT in the temporary table used.
mysql-test/r/func_gconcat.result:
Fix for bug #31154: field.h:1649: virtual int Field_bit::cmp(const uchar*, const uchar*): Assertion
- test result.
mysql-test/t/func_gconcat.test:
Fix for bug #31154: field.h:1649: virtual int Field_bit::cmp(const uchar*, const uchar*): Assertion
- test case.
sql/item_sum.cc:
Fix for bug #31154: field.h:1649: virtual int Field_bit::cmp(const uchar*, const uchar*): Assertion
- force the create_tmp_table() to convert BIT columns to INT
in order to be able to compare records containing BIT fields.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index c20d3fba705..48ad53fbf75 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3307,15 +3307,34 @@ bool Item_func_group_concat::setup(THD *thd) count_field_types(select_lex, tmp_table_param, all_fields, 0); tmp_table_param->force_copy_fields= force_copy_fields; DBUG_ASSERT(table == 0); - /* - Currently we have to force conversion of BLOB values to VARCHAR's - if we are to store them in TREE objects used for ORDER BY and - DISTINCT. This leads to truncation if the BLOB's size exceeds - Field_varstring::MAX_SIZE. - */ if (arg_count_order > 0 || distinct) + { + /* + Currently we have to force conversion of BLOB values to VARCHAR's + if we are to store them in TREE objects used for ORDER BY and + DISTINCT. This leads to truncation if the BLOB's size exceeds + Field_varstring::MAX_SIZE. + */ set_if_smaller(tmp_table_param->convert_blob_length, Field_varstring::MAX_SIZE); + + /* + Force the create_tmp_table() to convert BIT columns to INT + as we cannot compare two table records containg BIT fields + stored in the the tree used for distinct/order by. + Moreover we don't even save in the tree record null bits + where BIT fields store parts of their data. + */ + List_iterator_fast<Item> li(all_fields); + Item *item; + while ((item= li++)) + { + if (item->type() == Item::FIELD_ITEM && + ((Item_field*) item)->field->type() == FIELD_TYPE_BIT) + item->marker= 4; + } + } + /* We have to create a temporary table to get descriptions of fields (types, sizes and so on). |