Bug #1022 MYSQL crashes if a group function is used on a 'float' field
Submitted: 9 Aug 2003 23:45 Modified: 20 Oct 2003 7:14
Reporter: Ellie Small Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1-alpha OS:Windows (Windows XP)
Assigned to: Alexander Barkov CPU Architecture:Any

[9 Aug 2003 23:45] Ellie Small
Description:
When a table contains a 'float' field, and one of the functions MAX, MIN, or AVG is used on that field, the system crashes.

How to repeat:
Create a table containing a field defined as 'float'. Then select the max/min or avg of that field.

Suggested fix:
Changing the field to a 'double' fixes the problem.
[11 Aug 2003 7:33] MySQL Verification Team
For to reproduce this issue, we need to have more information
about, more specifically the language and the code used for
to build the dll with the udf.
[11 Aug 2003 8:53] Sergei Golubchik
Thanks, I was able to reproduce it
[16 Oct 2003 22:23] MySQL Verification Team
This crash still exists in the latest BK 4.1 tree:

mysql> create table u (id float);
Query OK, 0 rows affected (0.02 sec)

mysql> insert into u values (2334.9494949);
Query OK, 1 row affected (0.01 sec)

mysql> select max(id) from u;

/sql/protocol.cc
--703--

#ifndef DEBUG_OFF
  DBUG_ASSERT(field_types == 0 ||
	      field_types[field_pos] == MYSQL_TYPE_DECIMAL ||
	      (field_types[field_pos] >= MYSQL_TYPE_ENUM &&
	       field_types[field_pos] <= MYSQL_TYPE_GEOMETRY));
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
CALL STACK:

 mysqld.exe!_NMSG_WRITE(int rterrnum=10)  Line 221	C
 mysqld.exe!abort()  Line 44 + 0x7	C
 mysqld.exe!_assert(void * expr=0x007afc98, void * filename=0x007afc6c,
             unsigned int lineno=703)  Line 267	C
>mysqld.exe!Protocol_simple::store(const char * from=0x0578f260,
            unsigned int length=15, charset_info_st * 
            fromcs=0x007d5768)  Line 703 + 0x59	C++
 mysqld.exe!Item::send(Protocol * protocol=0x00e451b4, String
             * buffer=0x0578f248)  Line 1263 + 0x26	C++
 mysqld.exe!select_send::send_data(List<Item> & items={...})
            Line 633 + 0x19	C++
 mysqld.exe!end_send_group(JOIN * join=0x02e9bc68, st_join_table
            * join_tab=0x02e9ca58, int end_of_records=1)
            Line 6093 + 0x21	C++
 mysqld.exe!do_select(JOIN * join=0x02e9bc68, List<Item> 
            * fields=0x02e9c624, st_table * table=0x00000000,
            Procedure * procedure=0x00000000)  Line 5339 + 0xd	C++
 mysqld.exe!JOIN::exec()  Line 1440 + 0x2d	C++
 mysqld.exe!mysql_select(THD * thd=0x00e449f0, Item * * *
            rref_pointer_array=0x00e44e48, st_table_list
            * tables=0x02e9bbf0, unsigned int wild_num=0,
            List<Item> & fields={...}, Item * conds=0x00000000,
            unsigned int og_num=0, st_order * order=0x00000000,
            st_order * group=0x00000000, Item * having=0x00000000,
            st_order * proc_param=0x00000000, unsigned long 
            select_options=84448256, select_result * 
            result=0x02e9bc58, st_select_lex_unit * unit=0x00e44c74,
            st_select_lex * select_lex=0x00e44d5c,
            int tables_and_fields_initied=0)  Line 1556	C++
 mysqld.exe!handle_select(THD * thd=0x00e449f0, st_lex * lex=0x00e44c68,
            select_result * result=0x02e9bc58)  Line 191 + 0x8b	C++
 mysqld.exe!mysql_execute_command(THD * thd=0x00e449f0)
            Line 1802 + 0x11	C++
 mysqld.exe!mysql_parse(THD * thd=0x00e449f0, char * inBuf=0x02e9ba68,
            unsigned int length=21)  Line 3768 + 0x9	C++
 mysqld.exe!dispatch_command(enum_server_command command=COM_QUERY,
            THD * thd=0x00e449f0, char * packet=0x02eb2089,
            unsigned int packet_length=22)  Line 1295 + 0x1d	C++
 mysqld.exe!do_command(THD * thd=0x00e449f0)  Line 1129 + 0x31	C++
 mysqld.exe!handle_one_connection(void * arg=0x00e449f0)  Line 899 + 0x9 C++
 mysqld.exe!pthread_start(void * param=0x02e9b778)  Line 63 + 0x7	C
 mysqld.exe!_threadstart(void * ptd=0x02ea2930)  Line 173 + 0xd	C
 kernel32.dll!77e6d33b()
[20 Oct 2003 7:14] Alexander Barkov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html