Assertion `maybe_null && item->null_value' failed with ORDER BY LAST_DAY()

Bug #731103 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
High
Sergei Golubchik

Bug Description

Not repeatable in mysql-5.1 . Using LAST_DAY() in ORDER BY with non-date argument asserts as follows:

mysqld: filesort.cc:854: void make_sortkey(SORTPARAM*, uchar*, uchar*): Assertion `maybe_null && item->null_value' failed.

#8 0x006b0d98 in __assert_fail () from /lib/libc.so.6
#9 0x08386dc0 in make_sortkey (param=0xb6bccbb8,
    to=0xb6a041bc "\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245h4z\025e", ref_pos=0xb6bcc998 "") at filesort.cc:854
#10 0x08386429 in find_all_keys (param=0xb6bccbb8, select=0xb6a06398, sort_keys=0xb6a04188, buffpek_pointers=0xb6bcca30, tempfile=0xb6bccaf4, indexfile=0x0)
    at filesort.cc:620
#11 0x08385120 in filesort (thd=0x9c59090, table=0xb6a024f0, sortorder=0xb6a064a0, s_length=1, select=0xb6a06398, max_rows=18446744073709551615,
    sort_positions=false, examined_rows=0xb6bccd20) at filesort.cc:245
#12 0x082f5476 in create_sort_index (thd=0x9c59090, join=0xb6a04b58, order=0xb6a04aa8, filesort_limit=18446744073709551615,
    select_limit=18446744073709551615, is_order_by=false) at sql_select.cc:13890
#13 0x082d918e in JOIN::exec (this=0xb6a04b58) at sql_select.cc:2277
#14 0x082d9c62 in mysql_select (thd=0x9c59090, rref_pointer_array=0x9c5a570, tables=0xb6a04788, wild_num=1, fields=..., conds=0x0, og_num=1,
    order=0xb6a04aa8, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0xb6a04b40, unit=0x9c5a208, select_lex=0x9c5a478)
    at sql_select.cc:2544
#15 0x082d264e in handle_select (thd=0x9c59090, lex=0x9c5a1ac, result=0xb6a04b40, setup_tables_done_option=0) at sql_select.cc:269
#16 0x0827a78f in execute_sqlcom_select (thd=0x9c59090, all_tables=0xb6a04788) at sql_parse.cc:5129
#17 0x08271646 in mysql_execute_command (thd=0x9c59090) at sql_parse.cc:2278
#18 0x0827c948 in mysql_parse (thd=0x9c59090, rawbuf=0xb6a04628 "SELECT * FROM t1 ORDER BY LAST_DAY ( f2 )", length=41, found_semicolon=0xb6bce210)
    at sql_parse.cc:6054
#19 0x0826f2a0 in dispatch_command (command=COM_QUERY, thd=0x9c59090, packet=0x9c9e539 "SELECT * FROM t1 ORDER BY LAST_DAY ( f2 ) ", packet_length=43)
    at sql_parse.cc:1249
#20 0x0826e4d0 in do_command (thd=0x9c59090) at sql_parse.cc:889
#21 0x0826c815 in handle_one_connection (arg=0x9c59090) at sql_connect.cc:1136
#22 0x00821919 in start_thread () from /lib/libpthread.so.0
#23 0x0076acce in clone () from /lib/libc.so.6

test case:

CREATE TABLE t1 ( f2 int NOT NULL) ;
INSERT INTO t1 VALUES (0),(0);

SELECT * FROM t1 ORDER BY LAST_DAY ( f2 ) ;

Related branches

Changed in maria:
milestone: none → 5.3
assignee: nobody → Sergei (sergii)
Revision history for this message
Sergei Golubchik (sergii) wrote :

Nice. This assert has discovered an old bug in LAST_DAY :)

reported as http://bugs.mysql.com/bug.php?id=60385

Changed in maria:
status: New → Confirmed
importance: Undecided → High
Changed in maria:
status: Confirmed → Fix Committed
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.