Bug #52159 returning time type from function and empty left join causes debug assertion

Submitted: 17 Mar 2010 20:51 Modified: 4 Aug 2010 19:59
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Types Severity:S1 (Critical)
Version:5.5.3-debug, 5.5.4-debug, 5.6.99-m4-debug OS:Any
Assigned to: Alexander Barkov CPU Architecture:Any
Tags: assertion, regression, time

[17 Mar 2010 20:51] Shane Bester
Description:
Version: '5.6.99-m4-debug'  socket: ''  port: 3306  Source distribution
Assertion failed: fixed == 1, file .\item.cc, line 214

mysqld.exe!my_sigabrt_handler()[my_thr_init.c:519]
mysqld.exe!raise()[winsig.c:590]
mysqld.exe!abort()[abort.c:71]
mysqld.exe!_wassert()[assert.c:212]
mysqld.exe!Item::val_str_ascii()[item.cc:214]
mysqld.exe!Item::get_time()[item.cc:1006]
mysqld.exe!Item::send()[item.cc:5846]
mysqld.exe!Protocol::send_result_set_row()[protocol.cc:877]
mysqld.exe!select_send::send_data()[sql_class.cc:1730]
mysqld.exe!end_send_group()[sql_select.cc:12503]
mysqld.exe!do_select()[sql_select.cc:11198]
mysqld.exe!JOIN::exec()[sql_select.cc:2311]
mysqld.exe!mysql_select()[sql_select.cc:2508]
mysqld.exe!handle_select()[sql_select.cc:271]
mysqld.exe!execute_sqlcom_select()[sql_parse.cc:4703]
mysqld.exe!mysql_execute_command()[sql_parse.cc:2191]
mysqld.exe!mysql_parse()[sql_parse.cc:5735]
mysqld.exe!dispatch_command()[sql_parse.cc:1024]
mysqld.exe!do_command()[sql_parse.cc:710]
mysqld.exe!do_handle_one_connection()[sql_connect.cc:1174]
mysqld.exe!handle_one_connection()[sql_connect.cc:1113]
mysqld.exe!pthread_start()[my_winthread.c:61]
mysqld.exe!_callthreadstartex()[threadex.c:348]
mysqld.exe!_threadstartex()[threadex.c:331]

5.1.45-debug was not affected.

How to repeat:
#on debug build:

drop function if exists `f1`;
create function `f1`() returns time return 1;
drop table if exists `t1`;
create table `t1`(`b` int)engine=myisam;
insert into `t1` values (0);
select `f1`() from `t1` left join
( select 1 as `a` from `t1` limit 0
) as `d` on 1 group by `a`;
[17 Mar 2010 21:14] MySQL Verification Team
[miguel@hegel ~]$ dbs/5.5/bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.99-m4-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> drop function if exists `f1`;
Query OK, 0 rows affected (0.01 sec)

mysql> create function `f1`() returns time return 1;
Query OK, 0 rows affected (0.00 sec)

mysql> drop table if exists `t1`;
Query OK, 0 rows affected (0.00 sec)

mysql> create table `t1`(`b` int)engine=myisam;
Query OK, 0 rows affected (0.07 sec)

mysql> insert into `t1` values (0);
Query OK, 1 row affected (0.00 sec)

mysql> select `f1`() from `t1` left join
    -> ( select 1 as `a` from `t1` limit 0
    -> ) as `d` on 1 group by `a`;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[17 Mar 2010 21:17] MySQL Verification Team
Thank you for the bug report.

Server version: 5.1.46-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> drop function if exists `f1`;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> create function `f1`() returns time return 1;
Query OK, 0 rows affected (0.01 sec)

mysql> drop table if exists `t1`;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> create table `t1`(`b` int)engine=myisam;
Query OK, 0 rows affected (0.08 sec)

mysql> insert into `t1` values (0);
Query OK, 1 row affected (0.00 sec)

mysql> select `f1`() from `t1` left join
    -> ( select 1 as `a` from `t1` limit 0
    -> ) as `d` on 1 group by `a`;
+----------+
| `f1`()   |
+----------+
| 00:00:01 |
+----------+
1 row in set (0.00 sec)

mysql>
[28 Mar 2010 13:26] Guilhem Bichot
regression source:
bar@mysql.com-20100211041725-ijbox021olab82nv
WL#2649 Number-to-string conversions

Found by bzrfind.
[5 Jun 2010 11:25] Shane Bester
another testcase:

set names latin1; set sql_mode='';
drop table if exists `g1`;
create table `g1`(`a` char(215) character set utf8 not null,key(a))engine=myisam;
insert into `g1` values ();
select maketime(`a`,`a`,`a`) from `g1` group by 1 ;
[23 Jun 2010 7:51] 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/commits/111861

3064 Alexander Barkov	2010-06-23
      Bug#52159 returning time type from function and empty left join causes debug assertion
      
      Problem: Item_copy did not set "fixed", which resulted in DBUG_ASSERT in some cases.
      Fix: adding  initialization of the "fixed" member
      
      Adding tests:
        mysql-test/include/ctype_numconv.inc
        mysql-test/r/ctype_binary.result
        mysql-test/r/ctype_cp1251.result
        mysql-test/r/ctype_latin1.result
        mysql-test/r/ctype_ucs.result
      
      Adding initialization of the "fixed" member:
        sql/item.h
[7 Jul 2010 6:17] 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/commits/112993

3094 Alexander Barkov	2010-07-07
      Bug#52159 returning time type from function and empty left join causes debug assertion
      
      Problem: Item_copy did not set "fixed", which resulted in DBUG_ASSERT in some cases.
      Fix: adding  initialization of the "fixed" member
      
      Adding tests:
        mysql-test/include/ctype_numconv.inc
        mysql-test/r/ctype_binary.result
        mysql-test/r/ctype_cp1251.result
        mysql-test/r/ctype_latin1.result
        mysql-test/r/ctype_ucs.result
      
      Adding initialization of the "fixed" member:
        sql/item.h
[7 Jul 2010 6:18] Alexander Barkov
Pushed into mysql-trunk-bugfixing (currently labeled as 5.5.6-m3)
[7 Jul 2010 7:41] 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/commits/113001

3289 Alexander Barkov	2010-07-07 [merge]
      Merging  Bug#52159 from mysql-trunk-bugfixing
[7 Jul 2010 7:49] Alexander Barkov
Pushed into mysql-next-mr-bugfixing (5.6.99-m4)
[8 Jul 2010 17:14] Shane Bester
another testcase...

drop table if exists `t1`;
create table `t1`(`a` time)engine=myisam;
insert into `t1` values ();
select if(1,null,`a`) from `t1` group by null;
[9 Jul 2010 5:12] Alexander Barkov
Thanks Shane!
I checked the another test case, it now works fine in
mysql-trunk-bugfixing:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.6-m3-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> drop table if exists `t1`;
Query OK, 0 rows affected (0.00 sec)

mysql> create table `t1`(`a` time)engine=myisam;
Query OK, 0 rows affected (0.01 sec)

mysql> insert into `t1` values ();
Query OK, 1 row affected (0.00 sec)

mysql> select if(1,null,`a`) from `t1` group by null;
+----------------+
| if(1,null,`a`) |
+----------------+
| NULL           |
+----------------+
1 row in set (0.00 sec)
[23 Jul 2010 12:25] Bugs System
Pushed into mysql-trunk 5.5.6-m3 (revid:alik@sun.com-20100723121820-jryu2fuw3pc53q9w) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[23 Jul 2010 12:32] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100723121929-90e9zemk3jkr2ocy) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (pib:18)
[31 Jul 2010 16:29] Paul DuBois
Noted in 5.5.6 changelog.

Some queries involving GROUP BY and a function that returned DATE
raised a debug assertion.
[4 Aug 2010 8:06] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[4 Aug 2010 8:22] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[4 Aug 2010 19:59] Paul DuBois
Noted in 5.6.0 changelog.
[4 Aug 2010 22:50] Paul DuBois
Correction: Bug does not appear in any released 5.6.x version, so no 5.6.0 changelog entry is needed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.077 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.