Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.1, 10.2, 10.3, 10.4
Description
Note: Given that the query in the test case is hardly realistic, the failure is a debug assertion, and it doesn't seem to be reproducible on 10.5, I'm keeping it Minor. However, what concerns me more than the debug assertion is the dependency on sql_mode. I don't see why STRICT_TRANS_TABLES would have any effect here, and yet it does. It may be worth investigation.
Failing test case |
--source include/have_sequence.inc
|
|
SET sort_buffer_size=256*1024; |
|
CREATE TABLE t1 ( |
id INT NOT NULL, |
a CHAR(15), |
b VARCHAR(830) NOT NULL, |
KEY (id) |
) ENGINE=MyISAM;
|
|
INSERT INTO t1 SELECT seq, CONCAT('s',seq), CONCAT('seq',seq) FROM seq_1_to_340; |
|
SET SESSION sql_mode= ''; |
SELECT SUBSTR('foo' FROM id FOR 0) AS f1, CASE b WHEN 'foo' THEN id END AS f2, GROUP_CONCAT(a) AS f3 FROM t1 GROUP BY f1; |
|
# Cleanup
|
DROP TABLE t1; |
The test case above causes the assertion failure. However, the same test case, but with sql_mode=STRICT_TRANS_TABLES (default) does not:
Passing test case |
--source include/have_sequence.inc
|
|
SET sort_buffer_size=256*1024; |
|
CREATE TABLE t1 ( |
id INT NOT NULL, |
a CHAR(15), |
b VARCHAR(830) NOT NULL, |
KEY (id) |
) ENGINE=MyISAM;
|
|
INSERT INTO t1 SELECT seq, CONCAT('s',seq), CONCAT('seq',seq) FROM seq_1_to_340; |
|
SET SESSION sql_mode= 'STRICT_TRANS_TABLES'; |
SELECT SUBSTR('foo' FROM id FOR 0) AS f1, CASE b WHEN 'foo' THEN id END AS f2, GROUP_CONCAT(a) AS f3 FROM t1 GROUP BY f1; |
|
# Cleanup
|
DROP TABLE t1; |
Assertion failure with the failing test case:
10.2 4f5d5a78 |
mysqld: /data/src/10.2/sql/filesort.cc:296: SORT_INFO* filesort(THD*, TABLE*, Filesort*, Filesort_tracker*, JOIN*, table_map): Assertion `param.sort_length != 0' failed.
|
210103 2:38:51 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007f2342407f36 in __GI___assert_fail (assertion=0x5597fcc86543 "param.sort_length != 0", file=0x5597fcc86428 "/data/src/10.2/sql/filesort.cc", line=296, function=0x5597fcc864c0 "SORT_INFO* filesort(THD*, TABLE*, Filesort*, Filesort_tracker*, JOIN*, table_map)") at assert.c:101
|
#8 0x00005597fc3bb80b in filesort (thd=0x7f232c000d90, table=0x7f232c0a1f80, filesort=0x7f232c016400, tracker=0x7f232c016a98, join=0x7f232c013ea0, first_table_bit=1) at /data/src/10.2/sql/filesort.cc:296
|
#9 0x00005597fc1b8e64 in create_sort_index (thd=0x7f232c000d90, join=0x7f232c013ea0, tab=0x7f232c015538, fsort=0x7f232c016400) at /data/src/10.2/sql/sql_select.cc:22061
|
#10 0x00005597fc1b34e5 in st_join_table::sort_table (this=0x7f232c015538) at /data/src/10.2/sql/sql_select.cc:19823
|
#11 0x00005597fc1b3131 in join_init_read_record (tab=0x7f232c015538) at /data/src/10.2/sql/sql_select.cc:19764
|
#12 0x00005597fc1b1054 in sub_select (join=0x7f232c013ea0, join_tab=0x7f232c015538, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18855
|
#13 0x00005597fc1b0618 in do_select (join=0x7f232c013ea0, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18402
|
#14 0x00005597fc18a28f in JOIN::exec_inner (this=0x7f232c013ea0) at /data/src/10.2/sql/sql_select.cc:3641
|
#15 0x00005597fc189736 in JOIN::exec (this=0x7f232c013ea0) at /data/src/10.2/sql/sql_select.cc:3436
|
#16 0x00005597fc18a8f8 in mysql_select (thd=0x7f232c000d90, tables=0x7f232c013628, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f232c013d60, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f232c013e80, unit=0x7f232c004988, select_lex=0x7f232c0050c8) at /data/src/10.2/sql/sql_select.cc:3836
|
#17 0x00005597fc17ea72 in handle_select (thd=0x7f232c000d90, lex=0x7f232c0048c8, result=0x7f232c013e80, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
|
#18 0x00005597fc1493c5 in execute_sqlcom_select (thd=0x7f232c000d90, all_tables=0x7f232c013628) at /data/src/10.2/sql/sql_parse.cc:6247
|
#19 0x00005597fc13fd74 in mysql_execute_command (thd=0x7f232c000d90) at /data/src/10.2/sql/sql_parse.cc:3558
|
#20 0x00005597fc14d16d in mysql_parse (thd=0x7f232c000d90, rawbuf=0x7f232c0126f8 "SELECT SUBSTR('foo' FROM id FOR 0) AS f1, CASE b WHEN 'foo' THEN id END AS f2, GROUP_CONCAT(a) AS f3 FROM t1 GROUP BY f1", length=120, parser_state=0x7f233c5615f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7762
|
#21 0x00005597fc13b466 in dispatch_command (command=COM_QUERY, thd=0x7f232c000d90, packet=0x7f232c008b51 "", packet_length=120, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
|
#22 0x00005597fc139f61 in do_command (thd=0x7f232c000d90) at /data/src/10.2/sql/sql_parse.cc:1381
|
#23 0x00005597fc294360 in do_handle_one_connection (connect=0x5597ff319920) at /data/src/10.2/sql/sql_connect.cc:1336
|
#24 0x00005597fc2940c5 in handle_one_connection (arg=0x5597ff319920) at /data/src/10.2/sql/sql_connect.cc:1241
|
#25 0x00005597fcabbdcc in pfs_spawn_thread (arg=0x5597ff2fccb0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
|
#26 0x00007f2342917609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#27 0x00007f23424f3293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Reproducible on 10.1-10.4 debug builds, with at least MyISAM, InnoDB, Aria.
Could not reproduce on 10.5.
Initial test case, for 10.1:
--source include/have_sequence.inc
|
|
SET character_set_server= utf8; |
|
CREATE TABLE t1 (a CHAR(90) NOT NULL); |
INSERT INTO t1 SELECT 'foo' FROM seq_1_to_1024; |
SELECT 1 FROM t1 ORDER BY 'x', SUBSTR(a,271,1); |
|
# Cleanup
|
DROP TABLE t1; |
10.1 57ec42bc |
mysqld: /data/src/10.1/sql/filesort.cc:318: ha_rows filesort(THD*, TABLE*, SORT_FIELD*, uint, SQL_SELECT*, ha_rows, bool, ha_rows*, ha_rows*, Filesort_tracker*): Assertion `param.sort_length != 0' failed.
|
200722 15:45:31 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007f225dfecf12 in __GI___assert_fail (assertion=0x556e774dbd46 "param.sort_length != 0", file=0x556e774dbc80 "/data/src/10.1/sql/filesort.cc", line=318, function=0x556e774dc140 <filesort(THD*, TABLE*, st_sort_field*, unsigned int, SQL_SELECT*, unsigned long long, bool, unsigned long long*, unsigned long long*, Filesort_tracker*)::__PRETTY_FUNCTION__> "ha_rows filesort(THD*, TABLE*, SORT_FIELD*, uint, SQL_SELECT*, ha_rows, bool, ha_rows*, ha_rows*, Filesort_tracker*)") at assert.c:101
|
#8 0x0000556e76ccefc3 in filesort (thd=0x7f2256fcb070, table=0x7f225507dc70, sortorder=0x7f2255044ff0, s_length=1, select=0x7f2255044330, max_rows=18446744073709551615, sort_positions=false, examined_rows=0x7f225fc172f0, found_rows=0x7f225fc172f8, tracker=0x7f2255045030) at /data/src/10.1/sql/filesort.cc:318
|
#9 0x0000556e76b08eea in create_sort_index (thd=0x7f2256fcb070, join=0x7f2255042d90, order=0x7f2255042c58, filesort_limit=18446744073709551615, select_limit=18446744073709551615, is_order_by=true) at /data/src/10.1/sql/sql_select.cc:21825
|
#10 0x0000556e76ada66e in JOIN::exec_inner (this=0x7f2255042d90) at /data/src/10.1/sql/sql_select.cc:3242
|
#11 0x0000556e76ad7bb1 in JOIN::exec (this=0x7f2255042d90) at /data/src/10.1/sql/sql_select.cc:2564
|
#12 0x0000556e76adb0a7 in mysql_select (thd=0x7f2256fcb070, rref_pointer_array=0x7f2256fcf568, tables=0x7f2255042238, wild_num=0, fields=..., conds=0x0, og_num=2, order=0x7f22550428e0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f2255042d70, unit=0x7f2256fcebb8, select_lex=0x7f2256fcf2c0) at /data/src/10.1/sql/sql_select.cc:3501
|
#13 0x0000556e76ad0816 in handle_select (thd=0x7f2256fcb070, lex=0x7f2256fceaf8, result=0x7f2255042d70, setup_tables_done_option=0) at /data/src/10.1/sql/sql_select.cc:377
|
#14 0x0000556e76aa02d3 in execute_sqlcom_select (thd=0x7f2256fcb070, all_tables=0x7f2255042238) at /data/src/10.1/sql/sql_parse.cc:5682
|
#15 0x0000556e76a96f9f in mysql_execute_command (thd=0x7f2256fcb070) at /data/src/10.1/sql/sql_parse.cc:3029
|
#16 0x0000556e76aa3de0 in mysql_parse (thd=0x7f2256fcb070, rawbuf=0x7f2255042088 "SELECT 1 FROM t1 ORDER BY 'x', SUBSTR(a,271,1)", length=46, parser_state=0x7f225fc185f0) at /data/src/10.1/sql/sql_parse.cc:7200
|
#17 0x0000556e76a92fb7 in dispatch_command (command=COM_QUERY, thd=0x7f2256fcb070, packet=0x7f2258fee071 "SELECT 1 FROM t1 ORDER BY 'x', SUBSTR(a,271,1)", packet_length=46) at /data/src/10.1/sql/sql_parse.cc:1491
|
#18 0x0000556e76a91e9c in do_command (thd=0x7f2256fcb070) at /data/src/10.1/sql/sql_parse.cc:1123
|
#19 0x0000556e76bcfd3b in do_handle_one_connection (thd_arg=0x7f2256fcb070) at /data/src/10.1/sql/sql_connect.cc:1331
|
#20 0x0000556e76bcfa6c in handle_one_connection (arg=0x7f2256fcb070) at /data/src/10.1/sql/sql_connect.cc:1242
|
#21 0x0000556e76feded4 in pfs_spawn_thread (arg=0x7f225d439ef0) at /data/src/10.1/storage/perfschema/pfs.cc:1868
|
#22 0x00007f225f89b4a4 in start_thread (arg=0x7f225fc19700) at pthread_create.c:456
|
#23 0x00007f225e0a9d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
|