1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor

add_special_frame_cursors() did not check the return
value offset_func->fix_fields(). It can return an error
if the data type does not support the operator "minus".
This commit is contained in:
Alexander Barkov
2024-11-29 21:03:16 +04:00
committed by Oleksandr Byelkin
parent 432856c473
commit 0b7fa4c267
3 changed files with 30 additions and 6 deletions

View File

@ -5466,4 +5466,12 @@ CREATE TABLE t (f POINT, KEY(f));
DELETE FROM t WHERE f NOT IN (NULL,'x'); DELETE FROM t WHERE f NOT IN (NULL,'x');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
DROP TABLE t; DROP TABLE t;
#
# MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor
#
CREATE TABLE t (a INT, b POINT);
INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0));
SELECT NTH_VALUE(a,b) OVER () FROM t;
ERROR HY000: Illegal parameter data types point and bigint for operation '-'
DROP TABLE t;
# End of 10.5 tests # End of 10.5 tests

View File

@ -3472,4 +3472,14 @@ CREATE TABLE t (f POINT, KEY(f));
DELETE FROM t WHERE f NOT IN (NULL,'x'); DELETE FROM t WHERE f NOT IN (NULL,'x');
DROP TABLE t; DROP TABLE t;
--echo #
--echo # MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor
--echo #
CREATE TABLE t (a INT, b POINT);
INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0));
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT NTH_VALUE(a,b) OVER () FROM t;
DROP TABLE t;
--echo # End of 10.5 tests --echo # End of 10.5 tests

View File

@ -2528,7 +2528,7 @@ Frame_cursor *get_frame_cursor(THD *thd, Window_spec *spec, bool is_top_bound)
} }
static static
void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, bool add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager,
Item_window_func *window_func) Item_window_func *window_func)
{ {
Window_spec *spec= window_func->window_spec; Window_spec *spec= window_func->window_spec;
@ -2615,7 +2615,9 @@ void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager,
Item *offset_func= new (thd->mem_root) Item *offset_func= new (thd->mem_root)
Item_func_minus(thd, item_sum->get_arg(1), Item_func_minus(thd, item_sum->get_arg(1),
int_item); int_item);
offset_func->fix_fields(thd, &offset_func); if (offset_func->fix_fields(thd, &offset_func))
return true;
fc= new Frame_positional_cursor(*top_bound, fc= new Frame_positional_cursor(*top_bound,
*top_bound, *bottom_bound, *top_bound, *bottom_bound,
*offset_func, false); *offset_func, false);
@ -2648,6 +2650,7 @@ void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager,
fc->add_sum_func(item_sum); fc->add_sum_func(item_sum);
cursor_manager->add_cursor(fc); cursor_manager->add_cursor(fc);
} }
return false;
} }
@ -2675,7 +2678,7 @@ static bool is_computed_with_remove(Item_sum::Sumfunctype sum_func)
If the window functions share the same frame specification, If the window functions share the same frame specification,
those window functions will be registered to the same cursor. those window functions will be registered to the same cursor.
*/ */
void get_window_functions_required_cursors( bool get_window_functions_required_cursors(
THD *thd, THD *thd,
List<Item_window_func>& window_functions, List<Item_window_func>& window_functions,
List<Cursor_manager> *cursor_managers) List<Cursor_manager> *cursor_managers)
@ -2726,7 +2729,8 @@ void get_window_functions_required_cursors(
if (item_win_func->is_frame_prohibited() || if (item_win_func->is_frame_prohibited() ||
item_win_func->requires_special_cursors()) item_win_func->requires_special_cursors())
{ {
add_special_frame_cursors(thd, cursor_manager, item_win_func); if (add_special_frame_cursors(thd, cursor_manager, item_win_func))
return true;
cursor_managers->push_back(cursor_manager); cursor_managers->push_back(cursor_manager);
continue; continue;
} }
@ -2760,6 +2764,7 @@ void get_window_functions_required_cursors(
} }
cursor_managers->push_back(cursor_manager); cursor_managers->push_back(cursor_manager);
} }
return false;
} }
/** /**
@ -3034,8 +3039,9 @@ bool Window_func_runner::exec(THD *thd, TABLE *tbl, SORT_INFO *filesort_result)
it.rewind(); it.rewind();
List<Cursor_manager> cursor_managers; List<Cursor_manager> cursor_managers;
get_window_functions_required_cursors(thd, window_functions, if (get_window_functions_required_cursors(thd, window_functions,
&cursor_managers); &cursor_managers))
return true;
/* Go through the sorted array and compute the window function */ /* Go through the sorted array and compute the window function */
bool is_error= compute_window_func(thd, bool is_error= compute_window_func(thd,