mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
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.
This commit is contained in:
@@ -819,4 +819,46 @@ id group_concat(b.name)
|
||||
1 <09>ra,<2C>ra
|
||||
2 <09>ra,<2C>ra
|
||||
drop table t1;
|
||||
create table t1(a bit not null);
|
||||
insert into t1 values (), (), ();
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
select group_concat(distinct a) from t1;
|
||||
group_concat(distinct a)
|
||||
0
|
||||
select group_concat(distinct a order by a) from t1;
|
||||
group_concat(distinct a order by a)
|
||||
0
|
||||
drop table t1;
|
||||
create table t1(a bit(2) not null);
|
||||
insert into t1 values (1), (0), (0), (3), (1);
|
||||
select group_concat(distinct a) from t1;
|
||||
group_concat(distinct a)
|
||||
1,0,3
|
||||
select group_concat(distinct a order by a) from t1;
|
||||
group_concat(distinct a order by a)
|
||||
0,1,3
|
||||
select group_concat(distinct a order by a desc) from t1;
|
||||
group_concat(distinct a order by a desc)
|
||||
3,1,0
|
||||
drop table t1;
|
||||
create table t1(a bit(2), b varchar(10), c bit);
|
||||
insert into t1 values (1, 'a', 0), (0, 'b', 1), (0, 'c', 0), (3, 'd', 1),
|
||||
(1, 'e', 1), (3, 'f', 1), (0, 'g', 1);
|
||||
select group_concat(distinct a, c) from t1;
|
||||
group_concat(distinct a, c)
|
||||
10,01,00,31,11
|
||||
select group_concat(distinct a, c order by a) from t1;
|
||||
group_concat(distinct a, c order by a)
|
||||
00,01,11,10,31
|
||||
select group_concat(distinct a, c) from t1;
|
||||
group_concat(distinct a, c)
|
||||
10,01,00,31,11
|
||||
select group_concat(distinct a, c order by a, c) from t1;
|
||||
group_concat(distinct a, c order by a, c)
|
||||
00,01,10,11,31
|
||||
select group_concat(distinct a, c order by a desc, c desc) from t1;
|
||||
group_concat(distinct a, c order by a desc, c desc)
|
||||
31,11,10,01,00
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
||||
Reference in New Issue
Block a user