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
e7d169fb
Commit
e7d169fb
authored
Mar 19, 2008
by
kaa@kaamos.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge kaamos.(none):/data/src/opt/bug34512/my50
into kaamos.(none):/data/src/opt/bug34512/my51
parents
95fd6879
4ca61aa3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+6
-0
mysql-test/t/func_group.test
mysql-test/t/func_group.test
+10
-0
sql/item_sum.cc
sql/item_sum.cc
+9
-1
No files found.
mysql-test/r/func_group.result
View file @
e7d169fb
...
@@ -1410,4 +1410,10 @@ Note 1003 select (`test`.`t1`.`a` + 1) AS `y` from `test`.`t1` group by (`test`.
...
@@ -1410,4 +1410,10 @@ Note 1003 select (`test`.`t1`.`a` + 1) AS `y` from `test`.`t1` group by (`test`.
DROP VIEW v1;
DROP VIEW v1;
DROP TABLE t1;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
SET SQL_MODE=DEFAULT;
CREATE TABLE t1(a DOUBLE);
INSERT INTO t1 VALUES (10), (20);
SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1;
AVG(a) CAST(AVG(a) AS DECIMAL)
15 15
DROP TABLE t1;
End of 5.0 tests
End of 5.0 tests
mysql-test/t/func_group.test
View file @
e7d169fb
...
@@ -923,5 +923,15 @@ DROP VIEW v1;
...
@@ -923,5 +923,15 @@ DROP VIEW v1;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
SET
SQL_MODE
=
DEFAULT
;
SET
SQL_MODE
=
DEFAULT
;
#
# Bug #34512: CAST( AVG( double ) AS DECIMAL ) returns wrong results
#
CREATE
TABLE
t1
(
a
DOUBLE
);
INSERT
INTO
t1
VALUES
(
10
),
(
20
);
SELECT
AVG
(
a
),
CAST
(
AVG
(
a
)
AS
DECIMAL
)
FROM
t1
;
DROP
TABLE
t1
;
###
###
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/item_sum.cc
View file @
e7d169fb
...
@@ -1228,7 +1228,15 @@ my_decimal *Item_sum_avg::val_decimal(my_decimal *val)
...
@@ -1228,7 +1228,15 @@ my_decimal *Item_sum_avg::val_decimal(my_decimal *val)
null_value
=
1
;
null_value
=
1
;
return
NULL
;
return
NULL
;
}
}
sum_dec
=
Item_sum_sum
::
val_decimal
(
&
sum_buff
);
/*
For non-DECIMAL hybrid_type the division will be done in
Item_sum_avg::val_real().
*/
if
(
hybrid_type
!=
DECIMAL_RESULT
)
return
val_decimal_from_real
(
val
);
sum_dec
=
dec_buffs
+
curr_dec_buff
;
int2my_decimal
(
E_DEC_FATAL_ERROR
,
count
,
0
,
&
cnt
);
int2my_decimal
(
E_DEC_FATAL_ERROR
,
count
,
0
,
&
cnt
);
my_decimal_div
(
E_DEC_FATAL_ERROR
,
val
,
sum_dec
,
&
cnt
,
prec_increment
);
my_decimal_div
(
E_DEC_FATAL_ERROR
,
val
,
sum_dec
,
&
cnt
,
prec_increment
);
return
val
;
return
val
;
...
...
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