added a comment - Thanks! I repeated as described on 10.6-10.11 with InnoDB/Myisam, not a recent regression (I tried 10.6.11)
It seems to be the same bug as MDEV-28206 , and it was not fixed for sql_mode = "ONLY_FULL_GROUP_BY", so below I added test from there also:
CREATE TABLE div_req_sel_w_scores (
request_id int (11) NOT NULL ,
score_value int (11) NOT NULL ,
net_names int (11) not null ,
PRIMARY KEY (request_id, score_value)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE =latin1_swedish_ci;
CREATE TABLE div_mdl_seg (
model_id int (11) NOT NULL ,
seg_id smallint (6) NOT NULL ,
low_score int (11) NOT NULL ,
PRIMARY KEY (model_id, seg_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE =latin1_swedish_ci;
CREATE TABLE div_req_sel (
request_id int (11) NOT NULL AUTO_INCREMENT,
subsystem_id int (11) NOT NULL ,
model_id int (11) DEFAULT NULL ,
PRIMARY KEY (request_id, subsystem_id) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1006382 DEFAULT CHARSET=latin1 COLLATE =latin1_swedish_ci ROW_FORMAT= DYNAMIC ;
insert into div_req_sel
(request_id, subsystem_id, model_id)
values
(1462687, 4, 118620);
insert into div_mdl_seg
(model_id, seg_id, low_score)
values
(118620, 1, 50),
(118620, 2, 30);
insert into div_req_sel_w_scores
(request_id, score_value, net_names)
values
(1462687,-30, 351242),
(1462687,-29, 2090304);
PREPARE stmt FROM "
SELECT a.seg_id, s.score_value, s.net_names
FROM (SELECT rs.request_id, seg_id, low_score AS low_score_inclusive,
LEAD(low_score) OVER (PARTITION BY NULL ORDER BY seg_id) AS high_score_exclusive
FROM div_mdl_seg dms
JOIN div_req_sel rs USING (model_id)
WHERE request_id = 1462687
) a
LEFT JOIN div_req_sel_w_scores s
ON ( s.request_id = a.request_id
AND a.low_score_inclusive <= s.score_value
AND IFNULL(a.high_score_exclusive, 9999999) > s.score_value)
WHERE a.low_score_inclusive >=
(SELECT MIN(score_value)
FROM div_req_sel_w_scores
WHERE request_id = 1462687)
ORDER BY s.score_value DESC
" ;
set session sql_mode = "ONLY_FULL_GROUP_BY" ;
EXECUTE stmt;
set session sql_mode = "ONLY_FULL_GROUP_BY" ;
CREATE TABLE t1 ( a int , i int ) ;
CREATE TABLE t2 ( a int );
INSERT INTO t2 VALUES (4000);
execute immediate "SELECT sum(i) over (ORDER BY i) FROM t1 natural join t2;" ;
230517 15:55:24 [ERROR] mysqld got signal 11 ;
Server version: 10.6.14-MariaDB-debug-log source revision: a3e5b5c4db47cd29dc090d27db1d7f915cf774f6
sql/signal_handler.cc:241(handle_fatal_signal)[0x5574eb1ab0e6]
sigaction.c:0(__restore_rt)[0x7f9ecc9fd420]
sql/item.cc:6236(Item_field::fix_fields(THD*, Item**))[0x5574eb238256]
sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x5574ea664ff3]
sql/item_func.cc:350(Item_func::fix_fields(THD*, Item**))[0x5574eb306c46]
sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x5574ea664ff3]
sql/item.h:1156(Item::fix_fields_if_needed_for_scalar(THD*, Item**))[0x5574ea66502d]
sql/item.h:1161(Item::fix_fields_if_needed_for_bool(THD*, Item**))[0x5574ea7a1ef5]
sql/item_cmpfunc.cc:4946(Item_cond::fix_fields(THD*, Item**))[0x5574eb2ab57c]
sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x5574ea664ff3]
sql/item.h:1156(Item::fix_fields_if_needed_for_scalar(THD*, Item**))[0x5574ea66502d]
sql/item.h:1161(Item::fix_fields_if_needed_for_bool(THD*, Item**))[0x5574ea7a1ef5]
sql/sql_base.cc:8563(setup_conds(THD*, TABLE_LIST*, List<TABLE_LIST>&, Item**))[0x5574ea799357]
sql/sql_select.cc:862(setup_without_group(THD*, Bounds_checked_array<Item*>, TABLE_LIST*, List<TABLE_LIST>&, List<Item>&, List<Item>&, Item**, st_order*, st_order*, List<Window_spec>&, List<Item_window_func>&, bool*, unsigned int*))[0x5574ea9cfda2]
sql/sql_select.cc:1442(JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x5574ea9d758a]
sql/sql_union.cc:1105(st_select_lex_unit::prepare_join(THD*, st_select_lex*, select_result*, unsigned long long, bool))[0x5574eac1e301]
sql/sql_union.cc:1498(st_select_lex_unit::prepare(TABLE_LIST*, select_result*, unsigned long long))[0x5574eac21e9e]
sql/sql_derived.cc:840(mysql_derived_prepare(THD*, LEX*, TABLE_LIST*))[0x5574ea836854]
sql/sql_derived.cc:200(mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int))[0x5574ea832aba]
sql/table.cc:9386(TABLE_LIST::handle_derived(LEX*, unsigned int))[0x5574eaccd249]
sql/sql_lex.h:4491(LEX::handle_list_of_derived(TABLE_LIST*, unsigned int))[0x5574ea87e3b2]
sql/sql_lex.cc:4999(st_select_lex::handle_derived(LEX*, unsigned int))[0x5574ea8a4831]
sql/sql_select.cc:1341(JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x5574ea9d5ff4]
sql/sql_select.cc:5045(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x5574ea9fddd7]
sql/sql_select.cc:559(handle_select(THD*, LEX*, select_result*, unsigned long))[0x5574ea9cdd61]
sql/sql_parse.cc:6273(execute_sqlcom_select(THD*, TABLE_LIST*))[0x5574ea92ee5a]
sql/sql_parse.cc:3949(mysql_execute_command(THD*, bool))[0x5574ea91d7c7]
sql/sql_prepare.cc:5205(Prepared_statement::execute(String*, bool))[0x5574ea9921aa]
sql/sql_prepare.cc:4633(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x5574ea98d368]
sql/sql_prepare.cc:3687(mysql_sql_stmt_execute(THD*))[0x5574ea98692a]
sql/sql_parse.cc:3966(mysql_execute_command(THD*, bool))[0x5574ea91d80c]
sql/sql_parse.cc:8036(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x5574ea93a185]
sql/sql_parse.cc:1898(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x5574ea910005]
sql/sql_parse.cc:1409(do_command(THD*, bool))[0x5574ea90cd50]
sql/sql_connect.cc:1416(do_handle_one_connection(CONNECT*, bool))[0x5574ead8a6a9]
sql/sql_connect.cc:1320(handle_one_connection)[0x5574ead8a006]
perfschema/pfs.cc:2203(pfs_spawn_thread)[0x5574eba24f6e]
nptl/pthread_create.c:478(start_thread)[0x7f9ecc9f1609]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x62b0000d2340): SELECT a.seg_id, s.score_value, s.net_names
FROM (SELECT rs.request_id, seg_id, low_score AS low_score_inclusive,
LEAD(low_score) OVER (PARTITION BY NULL ORDER BY seg_id) AS high_score_exclusive
FROM div_mdl_seg dms
JOIN div_req_sel rs USING (model_id)
WHERE request_id = 1462687
) a
LEFT JOIN div_req_sel_w_scores s
ON ( s.request_id = a.request_id
AND a.low_score_inclusive <= s.score_value
AND IFNULL(a.high_score_exclusive, 9999999) > s.score_value)
WHERE a.low_score_inclusive >=
(SELECT MIN(score_value)
FROM div_req_sel_w_scores
WHERE request_id = 1462687)
ORDER BY s.score_value DESC
230517 15:58:35 [ERROR] mysqld got signal 11 ;
Server version: 10.6.14-MariaDB-debug-log source revision: a3e5b5c4db47cd29dc090d27db1d7f915cf774f6
sql/signal_handler.cc:241(handle_fatal_signal)[0x55c8043cd0e6]
sigaction.c:0(__restore_rt)[0x7fa0bc2fb420]
sql/item.cc:6236(Item_field::fix_fields(THD*, Item**))[0x55c80445a256]
sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x55c803886ff3]
sql/item_func.cc:350(Item_func::fix_fields(THD*, Item**))[0x55c804528c46]
sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x55c803886ff3]
sql/item.h:1156(Item::fix_fields_if_needed_for_scalar(THD*, Item**))[0x55c80388702d]
sql/item.h:1161(Item::fix_fields_if_needed_for_bool(THD*, Item**))[0x55c8039c3ef5]
sql/sql_base.cc:8452(setup_on_expr(THD*, TABLE_LIST*, bool))[0x55c8039ba727]
sql/sql_base.cc:8571(setup_conds(THD*, TABLE_LIST*, List<TABLE_LIST>&, Item**))[0x55c8039bb37f]
sql/sql_select.cc:862(setup_without_group(THD*, Bounds_checked_array<Item*>, TABLE_LIST*, List<TABLE_LIST>&, List<Item>&, List<Item>&, Item**, st_order*, st_order*, List<Window_spec>&, List<Item_window_func>&, bool*, unsigned int*))[0x55c803bf1da2]
sql/sql_select.cc:1442(JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x55c803bf958a]
sql/sql_select.cc:5045(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x55c803c1fdd7]
sql/sql_select.cc:559(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55c803befd61]
sql/sql_parse.cc:6273(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55c803b50e5a]
sql/sql_parse.cc:3949(mysql_execute_command(THD*, bool))[0x55c803b3f7c7]
sql/sql_prepare.cc:5205(Prepared_statement::execute(String*, bool))[0x55c803bb41aa]
sql/sql_prepare.cc:4633(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x55c803baf368]
sql/sql_prepare.cc:5357(Prepared_statement::execute_immediate(char const*, unsigned int))[0x55c803bb542e]
sql/sql_prepare.cc:3096(mysql_sql_stmt_execute_immediate(THD*))[0x55c803ba55dd]
sql/sql_parse.cc:3956(mysql_execute_command(THD*, bool))[0x55c803b3f7e4]
sql/sql_parse.cc:8036(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x55c803b5c185]
sql/sql_parse.cc:1898(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x55c803b32005]
sql/sql_parse.cc:1409(do_command(THD*, bool))[0x55c803b2ed50]
sql/sql_connect.cc:1416(do_handle_one_connection(CONNECT*, bool))[0x55c803fac6a9]
sql/sql_connect.cc:1320(handle_one_connection)[0x55c803fac006]
perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55c804c46f6e]
nptl/pthread_create.c:478(start_thread)[0x7fa0bc2ef609]
Query (0x62b0000d2c78): SELECT sum(i) over (ORDER BY i) FROM t1 natural join t2
Thanks! I repeated as described on 10.6-10.11 with InnoDB/Myisam, not a recent regression (I tried 10.6.11)
It seems to be the same bug as
MDEV-28206, and it was not fixed for sql_mode = "ONLY_FULL_GROUP_BY", so below I added test from there also:(request_id, subsystem_id, model_id)
(1462687, 4, 118620);
(model_id, seg_id, low_score)
(118620, 1, 50),
(118620, 2, 30);
(request_id, score_value, net_names)
(1462687,-30, 351242),
(1462687,-29, 2090304);
SELECT a.seg_id, s.score_value, s.net_names
FROM (SELECT rs.request_id, seg_id, low_score AS low_score_inclusive,
LEAD(low_score) OVER (PARTITION BY NULL ORDER BY seg_id) AS high_score_exclusive
FROM div_mdl_seg dms
JOIN div_req_sel rs USING (model_id)
WHERE request_id = 1462687
) a
LEFT JOIN div_req_sel_w_scores s
ON ( s.request_id = a.request_id
AND a.low_score_inclusive <= s.score_value
AND IFNULL(a.high_score_exclusive, 9999999) > s.score_value)
WHERE a.low_score_inclusive >=
(SELECT MIN(score_value)
FROM div_req_sel_w_scores
WHERE request_id = 1462687)
ORDER BY s.score_value DESC
230517 15:55:24 [ERROR] mysqld got signal 11 ;
Server version: 10.6.14-MariaDB-debug-log source revision: a3e5b5c4db47cd29dc090d27db1d7f915cf774f6
sql/signal_handler.cc:241(handle_fatal_signal)[0x5574eb1ab0e6]
sigaction.c:0(__restore_rt)[0x7f9ecc9fd420]
sql/item.cc:6236(Item_field::fix_fields(THD*, Item**))[0x5574eb238256]
sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x5574ea664ff3]
sql/item_func.cc:350(Item_func::fix_fields(THD*, Item**))[0x5574eb306c46]
sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x5574ea664ff3]
sql/item.h:1156(Item::fix_fields_if_needed_for_scalar(THD*, Item**))[0x5574ea66502d]
sql/item.h:1161(Item::fix_fields_if_needed_for_bool(THD*, Item**))[0x5574ea7a1ef5]
sql/item_cmpfunc.cc:4946(Item_cond::fix_fields(THD*, Item**))[0x5574eb2ab57c]
sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x5574ea664ff3]
sql/item.h:1156(Item::fix_fields_if_needed_for_scalar(THD*, Item**))[0x5574ea66502d]
sql/item.h:1161(Item::fix_fields_if_needed_for_bool(THD*, Item**))[0x5574ea7a1ef5]
sql/sql_base.cc:8563(setup_conds(THD*, TABLE_LIST*, List<TABLE_LIST>&, Item**))[0x5574ea799357]
sql/sql_select.cc:862(setup_without_group(THD*, Bounds_checked_array<Item*>, TABLE_LIST*, List<TABLE_LIST>&, List<Item>&, List<Item>&, Item**, st_order*, st_order*, List<Window_spec>&, List<Item_window_func>&, bool*, unsigned int*))[0x5574ea9cfda2]
sql/sql_select.cc:1442(JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x5574ea9d758a]
sql/sql_union.cc:1105(st_select_lex_unit::prepare_join(THD*, st_select_lex*, select_result*, unsigned long long, bool))[0x5574eac1e301]
sql/sql_union.cc:1498(st_select_lex_unit::prepare(TABLE_LIST*, select_result*, unsigned long long))[0x5574eac21e9e]
sql/sql_derived.cc:840(mysql_derived_prepare(THD*, LEX*, TABLE_LIST*))[0x5574ea836854]
sql/sql_derived.cc:200(mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int))[0x5574ea832aba]
sql/table.cc:9386(TABLE_LIST::handle_derived(LEX*, unsigned int))[0x5574eaccd249]
sql/sql_lex.h:4491(LEX::handle_list_of_derived(TABLE_LIST*, unsigned int))[0x5574ea87e3b2]
sql/sql_lex.cc:4999(st_select_lex::handle_derived(LEX*, unsigned int))[0x5574ea8a4831]
sql/sql_select.cc:1341(JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x5574ea9d5ff4]
sql/sql_select.cc:5045(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x5574ea9fddd7]
sql/sql_select.cc:559(handle_select(THD*, LEX*, select_result*, unsigned long))[0x5574ea9cdd61]
sql/sql_parse.cc:6273(execute_sqlcom_select(THD*, TABLE_LIST*))[0x5574ea92ee5a]
sql/sql_parse.cc:3949(mysql_execute_command(THD*, bool))[0x5574ea91d7c7]
sql/sql_prepare.cc:5205(Prepared_statement::execute(String*, bool))[0x5574ea9921aa]
sql/sql_prepare.cc:4633(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x5574ea98d368]
sql/sql_prepare.cc:3687(mysql_sql_stmt_execute(THD*))[0x5574ea98692a]
sql/sql_parse.cc:3966(mysql_execute_command(THD*, bool))[0x5574ea91d80c]
sql/sql_parse.cc:8036(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x5574ea93a185]
sql/sql_parse.cc:1898(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x5574ea910005]
sql/sql_parse.cc:1409(do_command(THD*, bool))[0x5574ea90cd50]
sql/sql_connect.cc:1416(do_handle_one_connection(CONNECT*, bool))[0x5574ead8a6a9]
sql/sql_connect.cc:1320(handle_one_connection)[0x5574ead8a006]
perfschema/pfs.cc:2203(pfs_spawn_thread)[0x5574eba24f6e]
nptl/pthread_create.c:478(start_thread)[0x7f9ecc9f1609]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x62b0000d2340): SELECT a.seg_id, s.score_value, s.net_names
FROM (SELECT rs.request_id, seg_id, low_score AS low_score_inclusive,
LEAD(low_score) OVER (PARTITION BY NULL ORDER BY seg_id) AS high_score_exclusive
FROM div_mdl_seg dms
JOIN div_req_sel rs USING (model_id)
WHERE request_id = 1462687
) a
LEFT JOIN div_req_sel_w_scores s
ON ( s.request_id = a.request_id
AND a.low_score_inclusive <= s.score_value
AND IFNULL(a.high_score_exclusive, 9999999) > s.score_value)
WHERE a.low_score_inclusive >=
(SELECT MIN(score_value)
FROM div_req_sel_w_scores
WHERE request_id = 1462687)
ORDER BY s.score_value DESC
230517 15:58:35 [ERROR] mysqld got signal 11 ;
Server version: 10.6.14-MariaDB-debug-log source revision: a3e5b5c4db47cd29dc090d27db1d7f915cf774f6
sql/signal_handler.cc:241(handle_fatal_signal)[0x55c8043cd0e6]
sigaction.c:0(__restore_rt)[0x7fa0bc2fb420]
sql/item.cc:6236(Item_field::fix_fields(THD*, Item**))[0x55c80445a256]
sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x55c803886ff3]
sql/item_func.cc:350(Item_func::fix_fields(THD*, Item**))[0x55c804528c46]
sql/item.h:1147(Item::fix_fields_if_needed(THD*, Item**))[0x55c803886ff3]
sql/item.h:1156(Item::fix_fields_if_needed_for_scalar(THD*, Item**))[0x55c80388702d]
sql/item.h:1161(Item::fix_fields_if_needed_for_bool(THD*, Item**))[0x55c8039c3ef5]
sql/sql_base.cc:8452(setup_on_expr(THD*, TABLE_LIST*, bool))[0x55c8039ba727]
sql/sql_base.cc:8571(setup_conds(THD*, TABLE_LIST*, List<TABLE_LIST>&, Item**))[0x55c8039bb37f]
sql/sql_select.cc:862(setup_without_group(THD*, Bounds_checked_array<Item*>, TABLE_LIST*, List<TABLE_LIST>&, List<Item>&, List<Item>&, Item**, st_order*, st_order*, List<Window_spec>&, List<Item_window_func>&, bool*, unsigned int*))[0x55c803bf1da2]
sql/sql_select.cc:1442(JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x55c803bf958a]
sql/sql_select.cc:5045(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x55c803c1fdd7]
sql/sql_select.cc:559(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55c803befd61]
sql/sql_parse.cc:6273(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55c803b50e5a]
sql/sql_parse.cc:3949(mysql_execute_command(THD*, bool))[0x55c803b3f7c7]
sql/sql_prepare.cc:5205(Prepared_statement::execute(String*, bool))[0x55c803bb41aa]
sql/sql_prepare.cc:4633(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x55c803baf368]
sql/sql_prepare.cc:5357(Prepared_statement::execute_immediate(char const*, unsigned int))[0x55c803bb542e]
sql/sql_prepare.cc:3096(mysql_sql_stmt_execute_immediate(THD*))[0x55c803ba55dd]
sql/sql_parse.cc:3956(mysql_execute_command(THD*, bool))[0x55c803b3f7e4]
sql/sql_parse.cc:8036(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x55c803b5c185]
sql/sql_parse.cc:1898(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x55c803b32005]
sql/sql_parse.cc:1409(do_command(THD*, bool))[0x55c803b2ed50]
sql/sql_connect.cc:1416(do_handle_one_connection(CONNECT*, bool))[0x55c803fac6a9]
sql/sql_connect.cc:1320(handle_one_connection)[0x55c803fac006]
perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55c804c46f6e]
nptl/pthread_create.c:478(start_thread)[0x7fa0bc2ef609]
Query (0x62b0000d2c78): SELECT sum(i) over (ORDER BY i) FROM t1 natural join t2