Menu

#1079 SUM() of integer field is shown as float instead of integer

Upstream
nobody
None
Defect
2009-04-06
2009-04-01
Anonymous
No

Originally created by: serge...@pisem.net

What exact steps will reproduce the problem?
1. Open HeidiSQL
2. Choose any table with integer field
3. Execute this query: SELECT SUM(`integer_field_name`) FROM `your_table_name`

What was the expected output?
Integer number.

What happened instead?
Floating point number returned (correct result, but with zero fractional part).

Version used?
HeidiSQL revision: [r2365] (4.0RC1 works ok)
MySQL Server version: 4.1.20-Community
Operating system: WinXP SP2

Related

Commit: [r2365]

Discussion

  • Anonymous

    Anonymous - 2009-04-01

    Originally posted by: a...@anse.de

    This is an issue in the older MySQL servers, not in HeidiSQL. On a 4.1.22 server I
    can reproduce that, but not on a 5.1.32 server. Cannot find the bug id at mysql.com
    though.

    Status: Upstream

     
  • Anonymous

    Anonymous - 2009-04-02

    Originally posted by: serge...@pisem.net

    Hmm. HeidiSQL 4.0 RC1 shows the result as integer, as an older revisions do.
    Tested the issue in commandline tool:
    -----------------------------------------------------------------
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 7 to server version: 4.1.20-community

    mysql> use test;
    Database changed
    mysql> select sum(rows_sent) from slow;
    +----------------+
    | sum(rows_sent) |
    +----------------+
    |        4483999 |
    +----------------+
    1 row in set (0.16 sec)
    -----------------------------------------------------------------

     
  • Anonymous

    Anonymous - 2009-04-02

    Originally posted by: a...@anse.de

    Then it is probably the client library (libmysql.dll) which has this bug. Must be the
    case, if you see integers in the result of SELECT rows_sent FROM slow (please test)

     
  • Anonymous

    Anonymous - 2009-04-02

    Originally posted by: serge...@pisem.net

    1. There was no such problem earlier
    2. I always updated only heidisql.exe
    3. Tested the issue with following dlls:
        - bundled with mysql4 (1187840 bytes)
        - bundled with mysql5 (1470464 bytes)
       Result is the same, as with your dll (1302528 bytes)

     
  • Anonymous

    Anonymous - 2009-04-02

    Originally posted by: serge...@pisem.net

    ds.Fields[i].DataType (Main.pas, 4741) returns ftFloat - bug in the Zeos probably?

     
  • Anonymous

    Anonymous - 2009-04-03

    Originally posted by: a...@anse.de

    Ah... got it. It was a bug prior to [r2320]. The ",0" part of float values only were
    truncated before which was reported as bug in issue #1012. So, it's like described:
    4.x servers return a float value, newer (5.1.x) return integers. Since [r2320] HeidiSQL
    just displays floats with the decimal part so they're noticable as such.

     

    Related

    Commit: [r2320]
    Tickets: #1012