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
cba78f82
Commit
cba78f82
authored
Feb 10, 2003
by
serg@sergbook.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
count(distint) on an empty table crash fixed
parent
c0b655aa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
4 deletions
+21
-4
.bzrignore
.bzrignore
+2
-0
mysql-test/r/count_distinct.result
mysql-test/r/count_distinct.result
+5
-0
mysql-test/t/count_distinct.test
mysql-test/t/count_distinct.test
+9
-0
sql/item_sum.cc
sql/item_sum.cc
+1
-2
sql/item_sum.h
sql/item_sum.h
+4
-2
No files found.
.bzrignore
View file @
cba78f82
...
...
@@ -523,3 +523,5 @@ vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
extra/mysql_waitpid
support-files/MacOSX/Description.plist
support-files/MacOSX/Info.plist
mysql-test/r/count_distinct.result
View file @
cba78f82
...
...
@@ -48,3 +48,8 @@ select t1.f1,count(distinct t2.f2),count(distinct 1,NULL) from t1 left join t2 o
f1 count(distinct t2.f2) count(distinct 1,NULL)
1 0 0
drop table t1,t2;
create table t1 (f int);
select count(distinct f) from t1;
count(distinct f)
0
drop table t1;
mysql-test/t/count_distinct.test
View file @
cba78f82
...
...
@@ -43,3 +43,12 @@ insert into t1 values (1);
create
table
t2
(
f1
int
,
f2
int
);
select
t1
.
f1
,
count
(
distinct
t2
.
f2
),
count
(
distinct
1
,
NULL
)
from
t1
left
join
t2
on
t1
.
f1
=
t2
.
f1
group
by
t1
.
f1
;
drop
table
t1
,
t2
;
#
# Empty tables
#
create
table
t1
(
f
int
);
select
count
(
distinct
f
)
from
t1
;
drop
table
t1
;
sql/item_sum.cc
View file @
cba78f82
...
...
@@ -918,7 +918,7 @@ int dump_leaf(byte* key, uint32 count __attribute__((unused)),
}
Item_sum_count_distinct
::~
Item_sum_count_distinc
t
()
void
Item_sum_count_distinct
::
no_rows_in_resul
t
()
{
if
(
table
)
free_tmp_table
(
current_thd
,
table
);
...
...
@@ -927,7 +927,6 @@ Item_sum_count_distinct::~Item_sum_count_distinct()
delete_tree
(
&
tree
);
}
bool
Item_sum_count_distinct
::
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
)
{
if
(
Item_sum_num
::
fix_fields
(
thd
,
tables
)
||
...
...
sql/item_sum.h
View file @
cba78f82
...
...
@@ -185,7 +185,8 @@ class Item_sum_count_distinct :public Item_sum_int
:
Item_sum_int
(
list
),
table
(
0
),
used_table_cache
(
~
(
table_map
)
0
),
tmp_table_param
(
0
),
use_tree
(
0
),
always_null
(
0
)
{
quick_group
=
0
;
}
~
Item_sum_count_distinct
();
~
Item_sum_count_distinct
()
{
no_rows_in_result
();
}
table_map
used_tables
()
const
{
return
used_table_cache
;
}
enum
Sumfunctype
sum_func
()
const
{
return
COUNT_DISTINCT_FUNC
;
}
void
reset
();
...
...
@@ -195,7 +196,8 @@ class Item_sum_count_distinct :public Item_sum_int
void
update_field
(
int
offset
)
{
return
;
}
// Never called
const
char
*
func_name
()
const
{
return
"count_distinct"
;
}
bool
setup
(
THD
*
thd
);
unsigned
int
size_of
()
{
return
sizeof
(
*
this
);}
void
no_rows_in_result
();
unsigned
int
size_of
()
{
return
sizeof
(
*
this
);}
};
...
...
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