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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
329d974d
Commit
329d974d
authored
May 30, 2005
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0
into moonbone.local:/work/mysql-5.0-bug-9593
parents
6ef172ef
077086cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
6 deletions
+29
-6
mysql-test/r/count_distinct.result
mysql-test/r/count_distinct.result
+6
-0
mysql-test/t/count_distinct.test
mysql-test/t/count_distinct.test
+12
-0
sql/sql_select.cc
sql/sql_select.cc
+11
-6
No files found.
mysql-test/r/count_distinct.result
View file @
329d974d
...
@@ -60,3 +60,9 @@ count(distinct a)
...
@@ -60,3 +60,9 @@ count(distinct a)
1
1
1
1
drop table t1;
drop table t1;
create table t1 (f1 int, f2 int);
insert into t1 values (0,1),(1,2);
select count(distinct if(f1,3,f2)) from t1;
count(distinct if(f1,3,f2))
2
drop table t1;
mysql-test/t/count_distinct.test
View file @
329d974d
...
@@ -63,3 +63,15 @@ create table t1 (a char(3), b char(20), primary key (a, b));
...
@@ -63,3 +63,15 @@ create table t1 (a char(3), b char(20), primary key (a, b));
insert
into
t1
values
(
'ABW'
,
'Dutch'
),
(
'ABW'
,
'English'
);
insert
into
t1
values
(
'ABW'
,
'Dutch'
),
(
'ABW'
,
'English'
);
select
count
(
distinct
a
)
from
t1
group
by
b
;
select
count
(
distinct
a
)
from
t1
group
by
b
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #9593 "The combination of COUNT, DISTINCT and CONCAT
# seems to lock the server"
# Bug appears only on Windows system
#
create
table
t1
(
f1
int
,
f2
int
);
insert
into
t1
values
(
0
,
1
),(
1
,
2
);
select
count
(
distinct
if
(
f1
,
3
,
f2
))
from
t1
;
drop
table
t1
;
sql/sql_select.cc
View file @
329d974d
...
@@ -12313,7 +12313,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
...
@@ -12313,7 +12313,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
{
{
Item
*
pos
;
Item
*
pos
;
List_iterator_fast
<
Item
>
li
(
all_fields
);
List_iterator_fast
<
Item
>
li
(
all_fields
);
Copy_field
*
copy
;
Copy_field
*
copy
=
NULL
;
res_selected_fields
.
empty
();
res_selected_fields
.
empty
();
res_all_fields
.
empty
();
res_all_fields
.
empty
();
List_iterator_fast
<
Item
>
itr
(
res_all_fields
);
List_iterator_fast
<
Item
>
itr
(
res_all_fields
);
...
@@ -12321,7 +12321,8 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
...
@@ -12321,7 +12321,8 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
uint
i
,
border
=
all_fields
.
elements
-
elements
;
uint
i
,
border
=
all_fields
.
elements
-
elements
;
DBUG_ENTER
(
"setup_copy_fields"
);
DBUG_ENTER
(
"setup_copy_fields"
);
if
(
!
(
copy
=
param
->
copy_field
=
new
Copy_field
[
param
->
field_count
]))
if
(
param
->
field_count
&&
!
(
copy
=
param
->
copy_field
=
new
Copy_field
[
param
->
field_count
]))
goto
err2
;
goto
err2
;
param
->
copy_funcs
.
empty
();
param
->
copy_funcs
.
empty
();
...
@@ -12360,9 +12361,12 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
...
@@ -12360,9 +12361,12 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
char
*
tmp
=
(
char
*
)
sql_alloc
(
field
->
pack_length
()
+
1
);
char
*
tmp
=
(
char
*
)
sql_alloc
(
field
->
pack_length
()
+
1
);
if
(
!
tmp
)
if
(
!
tmp
)
goto
err
;
goto
err
;
copy
->
set
(
tmp
,
item
->
result_field
);
if
(
copy
)
item
->
result_field
->
move_field
(
copy
->
to_ptr
,
copy
->
to_null_ptr
,
1
);
{
copy
++
;
copy
->
set
(
tmp
,
item
->
result_field
);
item
->
result_field
->
move_field
(
copy
->
to_ptr
,
copy
->
to_null_ptr
,
1
);
copy
++
;
}
}
}
}
}
else
if
((
pos
->
type
()
==
Item
::
FUNC_ITEM
||
else
if
((
pos
->
type
()
==
Item
::
FUNC_ITEM
||
...
@@ -12405,7 +12409,8 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
...
@@ -12405,7 +12409,8 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
err:
err:
delete
[]
param
->
copy_field
;
// This is never 0
if
(
copy
)
delete
[]
param
->
copy_field
;
// This is never 0
param
->
copy_field
=
0
;
param
->
copy_field
=
0
;
err2:
err2:
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
...
...
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