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
c1320384
Commit
c1320384
authored
Mar 29, 2007
by
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/ram/work/mysql-5.0-maint
into mysql.com:/home/ram/work/b21976/my50-b21976
parents
73f0c5d7
294ae90d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
34 deletions
+29
-34
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+9
-0
mysql-test/t/func_group.test
mysql-test/t/func_group.test
+10
-1
sql/item.h
sql/item.h
+5
-6
sql/item_sum.cc
sql/item_sum.cc
+5
-27
No files found.
mysql-test/r/func_group.result
View file @
c1320384
...
@@ -1296,6 +1296,15 @@ select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555;
...
@@ -1296,6 +1296,15 @@ select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555;
0.5 0.25
0.5 0.25
0.5000 0.2500
0.5000 0.2500
drop table bug22555;
drop table bug22555;
create table t1 (a decimal(20));
insert into t1 values (12345678901234567890);
select count(a) from t1;
count(a)
1
select count(distinct a) from t1;
count(distinct a)
1
drop table t1;
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
INSERT INTO t1 SELECT a, b+8 FROM t1;
INSERT INTO t1 SELECT a, b+8 FROM t1;
...
...
mysql-test/t/func_group.test
View file @
c1320384
...
@@ -793,6 +793,16 @@ select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555;
...
@@ -793,6 +793,16 @@ select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555;
drop
table
bug22555
;
drop
table
bug22555
;
#
# Bug #21976: Unnecessary warning with count(decimal)
#
create
table
t1
(
a
decimal
(
20
));
insert
into
t1
values
(
12345678901234567890
);
select
count
(
a
)
from
t1
;
select
count
(
distinct
a
)
from
t1
;
drop
table
t1
;
#
#
# Bug #23184: SELECT causes server crash
# Bug #23184: SELECT causes server crash
#
#
...
@@ -817,5 +827,4 @@ SELECT a,AVG(DISTINCT b) AS average FROM t1 GROUP BY a HAVING average > 50;
...
@@ -817,5 +827,4 @@ SELECT a,AVG(DISTINCT b) AS average FROM t1 GROUP BY a HAVING average > 50;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
###
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/item.h
View file @
c1320384
...
@@ -694,12 +694,11 @@ public:
...
@@ -694,12 +694,11 @@ public:
virtual
bool
get_date_result
(
TIME
*
ltime
,
uint
fuzzydate
)
virtual
bool
get_date_result
(
TIME
*
ltime
,
uint
fuzzydate
)
{
return
get_date
(
ltime
,
fuzzydate
);
}
{
return
get_date
(
ltime
,
fuzzydate
);
}
/*
/*
This function is used only in Item_func_isnull/Item_func_isnotnull
The method allows to determine nullness of a complex expression
(implementations of IS NULL/IS NOT NULL clauses). Item_func_is{not}null
without fully evaluating it, instead of calling val/result*() then
calls this method instead of one of val/result*() methods, which
checking null_value. Used in Item_func_isnull/Item_func_isnotnull
normally will set null_value. This allows to determine nullness of
and Item_sum_count/Item_sum_count_distinct.
a complex expression without fully evaluating it.
Any new item which can be NULL must implement this method.
Any new item which can be NULL must implement this call.
*/
*/
virtual
bool
is_null
()
{
return
0
;
}
virtual
bool
is_null
()
{
return
0
;
}
...
...
sql/item_sum.cc
View file @
c1320384
...
@@ -1050,14 +1050,8 @@ void Item_sum_count::clear()
...
@@ -1050,14 +1050,8 @@ void Item_sum_count::clear()
bool
Item_sum_count
::
add
()
bool
Item_sum_count
::
add
()
{
{
if
(
!
args
[
0
]
->
maybe_null
)
if
(
!
args
[
0
]
->
maybe_null
||
!
args
[
0
]
->
is_null
()
)
count
++
;
count
++
;
else
{
args
[
0
]
->
update_null_value
();
if
(
!
args
[
0
]
->
null_value
)
count
++
;
}
return
0
;
return
0
;
}
}
...
@@ -1890,14 +1884,8 @@ void Item_sum_count::reset_field()
...
@@ -1890,14 +1884,8 @@ void Item_sum_count::reset_field()
char
*
res
=
result_field
->
ptr
;
char
*
res
=
result_field
->
ptr
;
longlong
nr
=
0
;
longlong
nr
=
0
;
if
(
!
args
[
0
]
->
maybe_null
)
if
(
!
args
[
0
]
->
maybe_null
||
!
args
[
0
]
->
is_null
()
)
nr
=
1
;
nr
=
1
;
else
{
args
[
0
]
->
update_null_value
();
if
(
!
args
[
0
]
->
null_value
)
nr
=
1
;
}
int8store
(
res
,
nr
);
int8store
(
res
,
nr
);
}
}
...
@@ -2000,14 +1988,8 @@ void Item_sum_count::update_field()
...
@@ -2000,14 +1988,8 @@ void Item_sum_count::update_field()
char
*
res
=
result_field
->
ptr
;
char
*
res
=
result_field
->
ptr
;
nr
=
sint8korr
(
res
);
nr
=
sint8korr
(
res
);
if
(
!
args
[
0
]
->
maybe_null
)
if
(
!
args
[
0
]
->
maybe_null
||
!
args
[
0
]
->
is_null
()
)
nr
++
;
nr
++
;
else
{
args
[
0
]
->
update_null_value
();
if
(
!
args
[
0
]
->
null_value
)
nr
++
;
}
int8store
(
res
,
nr
);
int8store
(
res
,
nr
);
}
}
...
@@ -2431,12 +2413,8 @@ bool Item_sum_count_distinct::setup(THD *thd)
...
@@ -2431,12 +2413,8 @@ bool Item_sum_count_distinct::setup(THD *thd)
Item
*
item
=
args
[
i
];
Item
*
item
=
args
[
i
];
if
(
list
.
push_back
(
item
))
if
(
list
.
push_back
(
item
))
return
TRUE
;
// End of memory
return
TRUE
;
// End of memory
if
(
item
->
const_item
())
if
(
item
->
const_item
()
&&
item
->
is_null
())
{
always_null
=
1
;
item
->
update_null_value
();
if
(
item
->
null_value
)
always_null
=
1
;
}
}
}
if
(
always_null
)
if
(
always_null
)
return
FALSE
;
return
FALSE
;
...
...
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