Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
2ab4e3d1
Commit
2ab4e3d1
authored
Sep 14, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into mysql.com:/home/psergey/mysql-5.0-bug30324
parents
a87365e5
466747d5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
mysql-test/r/type_bit.result
mysql-test/r/type_bit.result
+15
-0
mysql-test/t/type_bit.test
mysql-test/t/type_bit.test
+14
-0
sql/item_sum.cc
sql/item_sum.cc
+17
-0
No files found.
mysql-test/r/type_bit.result
View file @
2ab4e3d1
...
@@ -657,4 +657,19 @@ b
...
@@ -657,4 +657,19 @@ b
#
#
#
#
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a int, b bit(2));
INSERT INTO t1 VALUES (3, 2), (2, 3), (2, 0), (3, 2), (3, 1);
SELECT COUNT(DISTINCT b) FROM t1 GROUP BY a;
COUNT(DISTINCT b)
2
2
DROP TABLE t1;
create table t2 (a int, b bit(2), c char(10));
INSERT INTO t2 VALUES (3, 2, 'two'), (2, 3, 'three'), (2, 0, 'zero'),
(3, 2, 'two'), (3, 1, 'one');
SELECT COUNT(DISTINCT b,c) FROM t2 GROUP BY a;
COUNT(DISTINCT b,c)
2
2
DROP TABLE t2;
End of 5.0 tests
End of 5.0 tests
mysql-test/t/type_bit.test
View file @
2ab4e3d1
...
@@ -304,4 +304,18 @@ SELECT b FROM t1 GROUP BY b;
...
@@ -304,4 +304,18 @@ SELECT b FROM t1 GROUP BY b;
--
disable_metadata
--
disable_metadata
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# BUG#30324 Wrong query result for COUNT(DISTINCT(bit_column))
#
CREATE
TABLE
t1
(
a
int
,
b
bit
(
2
));
INSERT
INTO
t1
VALUES
(
3
,
2
),
(
2
,
3
),
(
2
,
0
),
(
3
,
2
),
(
3
,
1
);
SELECT
COUNT
(
DISTINCT
b
)
FROM
t1
GROUP
BY
a
;
DROP
TABLE
t1
;
create
table
t2
(
a
int
,
b
bit
(
2
),
c
char
(
10
));
INSERT
INTO
t2
VALUES
(
3
,
2
,
'two'
),
(
2
,
3
,
'three'
),
(
2
,
0
,
'zero'
),
(
3
,
2
,
'two'
),
(
3
,
1
,
'one'
);
SELECT
COUNT
(
DISTINCT
b
,
c
)
FROM
t2
GROUP
BY
a
;
DROP
TABLE
t2
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/item_sum.cc
View file @
2ab4e3d1
...
@@ -2464,6 +2464,23 @@ bool Item_sum_count_distinct::setup(THD *thd)
...
@@ -2464,6 +2464,23 @@ bool Item_sum_count_distinct::setup(THD *thd)
count_field_types
(
select_lex
,
tmp_table_param
,
list
,
0
);
count_field_types
(
select_lex
,
tmp_table_param
,
list
,
0
);
tmp_table_param
->
force_copy_fields
=
force_copy_fields
;
tmp_table_param
->
force_copy_fields
=
force_copy_fields
;
DBUG_ASSERT
(
table
==
0
);
DBUG_ASSERT
(
table
==
0
);
/*
Make create_tmp_table() convert BIT columns to BIGINT.
This is needed because BIT fields store parts of their data in table's
null bits, and we don't have methods to compare two table records, which
is needed by Unique which is used when HEAP table is used.
*/
{
List_iterator_fast
<
Item
>
li
(
list
);
Item
*
item
;
while
((
item
=
li
++
))
{
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
((
Item_field
*
)
item
)
->
field
->
type
()
==
FIELD_TYPE_BIT
)
item
->
marker
=
4
;
}
}
if
(
!
(
table
=
create_tmp_table
(
thd
,
tmp_table_param
,
list
,
(
ORDER
*
)
0
,
1
,
if
(
!
(
table
=
create_tmp_table
(
thd
,
tmp_table_param
,
list
,
(
ORDER
*
)
0
,
1
,
0
,
0
,
(
select_lex
->
options
|
thd
->
options
),
(
select_lex
->
options
|
thd
->
options
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment