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
6a15e013
Commit
6a15e013
authored
Mar 07, 2005
by
pem@mysql.comhem.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed BUG#8937: Stored Procedure: AVG() works as SUM() in SELECT ... INTO statement
parent
9c2fe003
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
1 deletion
+46
-1
mysql-test/r/sp.result
mysql-test/r/sp.result
+19
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+25
-1
sql/item_sum.h
sql/item_sum.h
+2
-0
No files found.
mysql-test/r/sp.result
View file @
6a15e013
...
...
@@ -2736,4 +2736,23 @@ call bug8849()|
call bug8849()|
drop procedure bug8849|
drop tables t3,t4,t5|
drop procedure if exists bug8937|
create procedure bug8937()
begin
declare s,x,y,z int;
declare a float;
select sum(data),avg(data),min(data),max(data) into s,x,y,z from t1;
select s,x,y,z;
select avg(data) into a from t1;
select a;
end|
delete from t1|
insert into t1 (data) values (1), (2), (3), (4), (6)|
call bug8937()|
s x y z
16 3 1 6
a
3.2000
drop procedure bug8937|
delete from t1|
drop table t1,t2;
mysql-test/t/sp.test
View file @
6a15e013
...
...
@@ -3330,8 +3330,32 @@ call bug8849()|
drop
procedure
bug8849
|
drop
tables
t3
,
t4
,
t5
|
#
# BUG#8937: Stored Procedure: AVG() works as SUM() in SELECT ... INTO statement
#
--
disable_warnings
drop
procedure
if
exists
bug8937
|
--
enable_warnings
create
procedure
bug8937
()
begin
declare
s
,
x
,
y
,
z
int
;
declare
a
float
;
select
sum
(
data
),
avg
(
data
),
min
(
data
),
max
(
data
)
into
s
,
x
,
y
,
z
from
t1
;
select
s
,
x
,
y
,
z
;
select
avg
(
data
)
into
a
from
t1
;
select
a
;
end
|
delete
from
t1
|
insert
into
t1
(
data
)
values
(
1
),
(
2
),
(
3
),
(
4
),
(
6
)
|
call
bug8937
()
|
drop
procedure
bug8937
|
delete
from
t1
|
# Add bug above this line. Use existing tables t1 and t2 when
# Add bug
s
above this line. Use existing tables t1 and t2 when
# practical, or create table t3, t3 etc temporarily (and drop them).
delimiter
;
|
drop
table
t1
,
t2
;
sql/item_sum.h
View file @
6a15e013
...
...
@@ -356,6 +356,8 @@ public:
void
clear
();
bool
add
();
double
val_real
();
// In SPs we might force the "wrong" type with select into a declare variable
longlong
val_int
()
{
return
(
longlong
)
val_real
();
}
my_decimal
*
val_decimal
(
my_decimal
*
);
String
*
val_str
(
String
*
str
);
void
reset_field
();
...
...
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