Bug #19559 round does not strip trailing zeroes if second parameter comes from a table
Submitted: 5 May 2006 11:28 Modified: 14 Dec 2007 14:14
Reporter: Balint Toth Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.45-Debian_1 OS:Linux (Linux 2.6.14-1-686-smp)
Assigned to: Martin Hansson CPU Architecture:Any

[5 May 2006 11:28] Balint Toth
Description:
round does not strip trailing zeroes when the second parameter comes from a table

same results with version 5.0.20a-Debian_2 on a 64 bit system (Linux 2.6.8-11-em64t-p4-smp)

How to repeat:
create table testround (int i);
insert into testround values (2);
select round(1.23456,i) from testround;

>     1.23000

with a variable:
select @a:=i from testround;
select round(1.23456,@a);
>              1.23

with constant:
select round(1.23456,2);
>             1.23
[5 May 2006 12:38] Hartmut Holzgraefe
verified on 5.0 with current bitkeeper sources, will attach testcase
[5 May 2006 12:49] Hartmut Holzgraefe
mysqltest test case

Attachment: bug19559.tar.gz (application/x-gzip, text), 815 bytes.

[11 May 2006 10:00] Balint Toth
tried to find a workaround, truncate(round(1.23456,2),2) seemed fine but truncate function also has the same problem.
[12 Dec 2007 13:26] Martin Hansson
Can't repeat on current BK sources.

mysql> CREATE TABLE t1 (i int);
Query OK, 0 rows affected (0.03 sec)

mysql> INSERT INTO t1 VALUES (2);
Query OK, 1 row affected (0.00 sec)

mysql> SELECT ROUND(1.23456, i) FROM t1;
+-------------------+
| ROUND(1.23456, i) |
+-------------------+
|              1.23 |
+-------------------+
1 row in set (0.00 sec)

mysql> select version();
+--------------+
| version()    |
+--------------+
| 5.0.52-debug |
+--------------+
1 row in set (0.00 sec)
[14 Dec 2007 14:14] Balint Toth
It seems like someone fixed it in the 5.0 series.