Bug #8937 Stored Procedure: AVG() works as SUM() in SELECT ... INTO statement
| Submitted: | 4 Mar 2005 1:29 | Modified: | 8 Mar 2005 18:12 |
|---|---|---|---|
| Reporter: | Shuichi Tamagawa | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.3-alpha-20050216 | OS: | Linux (SuSE Linux 9.2) |
| Assigned to: | Per-Erik Martin | CPU Architecture: | Any |
[7 Mar 2005 17:26]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/22743
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: AVG() function works as SUM() function if it is used in ''SELECT ... INTO" statement. How to repeat: mysql>select * from t1// +------+ | a | +------+ | 10 | | 20 | | 30 | | 40 | | 50 | +------+ 5 rows in set (0.00 sec) mysql>select avg(a),max(a),min(a) from t1// +---------+--------+--------+ | avg(a) | max(a) | min(a) | +---------+--------+--------+ | 30.0000 | 50 | 10 | +---------+--------+--------+ 1 row in set (0.00 sec) mysql>CREATE PROCEDURE `test`.`sp1`() -> begin -> declare x int; -> declare y int; -> declare z int; -> select avg(a),max(a),min(a) into x,y,z from t1; -> insert into t2 values(x,y,z); -> end// Query OK, 0 rows affected (0.01 sec) mysql>call sp1()// Query OK, 1 row affected (0.00 sec) mysql>select * from t2// +------+------+------+ | x | y | z | +------+------+------+ | 150 | 50 | 10 | +------+------+------+ 1 row in set (0.00 sec) Suggested fix: The value of x should be "30.0000".