mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-31296: Crash in Item_func::fix_fields when prepared statement with subqueries and window function is executed with sql_mode = ONLY_FULL_GROUP_BY
Crash was caused by referencing a null pointer on getting the number of the nesting levels of the set function for the current select_lex at the method Item_field::fix_fields. The current select for processing is taken from Name_resolution_context that filled in at the function set_new_item_local_context() and where initialization of the data member Name_resolution_context was mistakenly removed by the commitd6ee351bbb
(Revert "MDEV-24454 Crash at change_item_tree") To fix the issue, correct initialization of data member Name_resolution_context::select_lex that was removed by the commitd6ee351bbb
is restored.
This commit is contained in:
@ -4415,5 +4415,18 @@ NULL
|
||||
DROP FUNCTION f;
|
||||
DROP TABLE t;
|
||||
#
|
||||
# MDEV-31296: Crash in Item_func::fix_fields when prepared statement
|
||||
# with subqueries and window function is executed with
|
||||
# sql_mode = ONLY_FULL_GROUP_BY
|
||||
#
|
||||
CREATE TABLE t1 ( a INT, i INT) ;
|
||||
CREATE TABLE t2 ( a INT);
|
||||
INSERT INTO t2 VALUES (4000);
|
||||
SET SESSION sql_mode = "ONLY_FULL_GROUP_BY";
|
||||
EXECUTE IMMEDIATE "SELECT SUM(i) OVER (ORDER BY i) FROM t1 NATURAL JOIN t2";
|
||||
SUM(i) OVER (ORDER BY i)
|
||||
# Clean up
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# End of 10.6 tests
|
||||
#
|
||||
|
Reference in New Issue
Block a user