[MDEV-5750] Assertion `ltime->year == 0' fails on a query with EXTRACT DAY_MINUTE and TIME column Created: 2014-02-26  Updated: 2014-08-16  Resolved: 2014-07-23

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.36, 10.0.8, 5.3.13
Fix Version/s: 5.5.39, 10.0.13, 5.3.13

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-6592 Assertion `ltime->day == 0' failed wi... Closed

 Description   

Initially reported as https://github.com/Tokutek/mariadb/issues/49

CREATE TABLE t1 ( d DATE, t TIME );
INSERT INTO t1 VALUES ('2008-12-05','22:34:09'),('2005-03-27','14:26:02');
 
SELECT EXTRACT( DAY_MINUTE FROM GREATEST( t, d ) ) FROM t1;

mysqld: time.cc:1074: void time_to_daytime_interval(MYSQL_TIME*): Assertion `ltime->year == 0' failed.
140227  1:18:13 [ERROR] mysqld got signal 6 ;

#6  0x00007ffc22efe621 in *__GI___assert_fail (assertion=0xd627b1 "ltime->year == 0", file=<optimized out>, line=1074, function=0xd62e60 "void time_to_daytime_interval(MYSQL_TIME*)") at assert.c:81
#7  0x00000000007ec869 in time_to_daytime_interval (ltime=0x7ffc1a419ea0) at time.cc:1074
#8  0x000000000061ab25 in Item_extract::val_int (this=0x26f9d08) at item_timefunc.cc:2035
#9  0x00000000005af02e in Item::send (this=0x26f9d08, protocol=0x2675f90, buffer=0x7ffc1a419ff0) at item.cc:6099
#10 0x000000000067dc57 in select_send::send_data (this=0x26fa340, items=...) at sql_class.cc:2013
#11 0x0000000000752329 in end_send (join=0x26fa360, join_tab=0x26fb600, end_of_records=false) at sql_select.cc:17323
#12 0x000000000075023d in evaluate_join_record (join=0x26fa360, join_tab=0x26fb2e0, error=0) at sql_select.cc:16463
#13 0x000000000074fa24 in sub_select (join=0x26fa360, join_tab=0x26fb2e0, end_of_records=false) at sql_select.cc:16265
#14 0x000000000074f125 in do_select (join=0x26fa360, fields=0x2678730, table=0x0, procedure=0x0) at sql_select.cc:15918
#15 0x000000000072e4f5 in JOIN::exec (this=0x26fa360) at sql_select.cc:2786
#16 0x000000000072ed8f in mysql_select (thd=0x2675b88, rref_pointer_array=0x2678878, tables=0x26f9e98, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0x26fa340, unit=0x2678118, select_lex=0x2678620) at sql_select.cc:3007
#17 0x00000000007257f5 in handle_select (thd=0x2675b88, lex=0x2678078, result=0x26fa340, setup_tables_done_option=0) at sql_select.cc:288
#18 0x00000000006b452c in execute_sqlcom_select (thd=0x2675b88, all_tables=0x26f9e98) at sql_parse.cc:5172
#19 0x00000000006ab6c8 in mysql_execute_command (thd=0x2675b88) at sql_parse.cc:2305
#20 0x00000000006b6e93 in mysql_parse (thd=0x2675b88, rawbuf=0x26f98c0 "SELECT EXTRACT( DAY_MINUTE FROM GREATEST( t, d ) ) FROM t1", length=58, found_semicolon=0x7ffc1a41bcb8) at sql_parse.cc:6173
#21 0x00000000006a8ea8 in dispatch_command (command=COM_QUERY, thd=0x2675b88, packet=0x26f0459 "", packet_length=59) at sql_parse.cc:1243
#22 0x00000000006a8194 in do_command (thd=0x2675b88) at sql_parse.cc:923
#23 0x00000000006a5025 in handle_one_connection (arg=0x2675b88) at sql_connect.cc:1231
#24 0x00007ffc23c0ab50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#25 0x00007ffc22fada7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

Stack trace from:

revision-id: igor@askmonty.org-20140221052733-ypg4dpfcmy5l0b3q
revno: 3765
branch-nick: 5.3



 Comments   
Comment by Elena Stepanova [ 2014-02-27 ]

The problem appeared on the 5.3 tree with the following revision:

revno: 3729
revision-id: bar@mnogosearch.org-20131202110934-nrq1aq7mc8g97v4h
message:
  MDEV-4857 Wrong result of HOUR('1 00:00:00')

Comment by Alexander Barkov [ 2014-07-23 ]

Pushed into 5.3 and 5.5

Generated at Thu Feb 08 07:06:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.