MDEV-33472 Assertion `0' failed in Item_row::illegal_method_call on CREATE EVENT

Do not accept rows as event parameters.
This commit is contained in:
Alexander Barkov 2024-11-12 08:58:48 +04:00
parent 20eba06d9b
commit 425d2521ec
3 changed files with 55 additions and 0 deletions

View file

@ -869,3 +869,14 @@ USE test;
DROP DATABASE events_test;
SET GLOBAL event_scheduler= 'ON';
SET @@global.concurrent_insert= @concurrent_insert;
#
# MDEV-33472 Assertion `0' failed in Item_row::illegal_method_call on CREATE EVENT
#
CREATE EVENT e ON SCHEDULE EVERY 1 HOUR STARTS ROW(1,2) DO SELECT 1;
ERROR 21000: Operand should contain 1 column(s)
CREATE EVENT e ON SCHEDULE EVERY 1 HOUR ENDS ROW(1,2) DO SELECT 1;
ERROR 21000: Operand should contain 1 column(s)
CREATE EVENT e ON SCHEDULE AT ROW(1,2) DO SELECT *;
ERROR 21000: Operand should contain 1 column(s)
CREATE EVENT e ON SCHEDULE EVERY ROW(1,2) HOUR DO SELECT 1;
ERROR 21000: Operand should contain 1 column(s)

View file

@ -1308,3 +1308,20 @@ SET GLOBAL event_scheduler= 'ON';
--source include/running_event_scheduler.inc
SET @@global.concurrent_insert= @concurrent_insert;
# THIS MUST BE THE LAST LINE in this file.
--echo #
--echo # MDEV-33472 Assertion `0' failed in Item_row::illegal_method_call on CREATE EVENT
--echo #
--error ER_OPERAND_COLUMNS
CREATE EVENT e ON SCHEDULE EVERY 1 HOUR STARTS ROW(1,2) DO SELECT 1;
--error ER_OPERAND_COLUMNS
CREATE EVENT e ON SCHEDULE EVERY 1 HOUR ENDS ROW(1,2) DO SELECT 1;
--error ER_OPERAND_COLUMNS
CREATE EVENT e ON SCHEDULE AT ROW(1,2) DO SELECT *;
--error ER_OPERAND_COLUMNS
CREATE EVENT e ON SCHEDULE EVERY ROW(1,2) HOUR DO SELECT 1;

View file

@ -211,6 +211,12 @@ Event_parse_data::init_execute_at(THD *thd)
if (item_execute_at->fix_fields(thd, &item_execute_at))
goto wrong_value;
if (item_execute_at->check_cols(1))
{
// Don't go to wrong_value, it will call val_str() and hit DBUG_ASSERT(0)
DBUG_RETURN(ER_WRONG_VALUE);
}
/* no starts and/or ends in case of execute_at */
DBUG_PRINT("info", ("starts_null && ends_null should be 1 is %d",
(starts_null && ends_null)));
@ -281,6 +287,12 @@ Event_parse_data::init_interval(THD *thd)
if (item_expression->fix_fields(thd, &item_expression))
goto wrong_value;
if (item_expression->check_cols(1))
{
// Don't go to wrong_value, it will call val_str() and hit DBUG_ASSERT(0)
DBUG_RETURN(ER_WRONG_VALUE);
}
if (get_interval_value(thd, item_expression, interval, &interval_tmp))
goto wrong_value;
@ -384,6 +396,12 @@ Event_parse_data::init_starts(THD *thd)
if (item_starts->fix_fields(thd, &item_starts))
goto wrong_value;
if (item_starts->check_cols(1))
{
// Don't go to wrong_value, it will call val_str() and hit DBUG_ASSERT(0)
DBUG_RETURN(ER_WRONG_VALUE);
}
if (item_starts->get_date(thd, &ltime, TIME_NO_ZERO_DATE |
thd->temporal_round_mode()))
goto wrong_value;
@ -439,6 +457,15 @@ Event_parse_data::init_ends(THD *thd)
if (item_ends->fix_fields(thd, &item_ends))
goto error_bad_params;
if (item_ends->check_cols(1))
{
/*
Don't go to error_bad_params it will call val_str() and
hit DBUG_ASSERT(0)
*/
DBUG_RETURN(EVEX_BAD_PARAMS);
}
DBUG_PRINT("info", ("convert to TIME"));
if (item_ends->get_date(thd, &ltime, TIME_NO_ZERO_DATE |
thd->temporal_round_mode()))