summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-05-14 20:43:21 +0300
committerSergei Petrunia <psergey@askmonty.org>2021-05-19 23:12:52 +0300
commite570f740cdabb1774683203ee848d522c6588dbc (patch)
tree1edbd14122c863ebbcd4006686d07567dd1c9f0f /sql/item.cc
parentaf8d4a97e29905f2806e7f26b420ce517e96c723 (diff)
downloadmariadb-git-e570f740cdabb1774683203ee848d522c6588dbc.tar.gz
MDEV-25629: Crash in get_sort_by_table() in subquery with order by having outer ref
In Item_field::fix_fields(): when the item was resolved to an Item_field in the SELECT's select_list, copy the Item_field's "depended_from" field. Failure to do so caused the item to have incorrect attributes: it pointed to a Field in an upper select but used_tables() didn't return OUTER_REF_TABLE_BIT.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 42272fe0148..be64edca9a1 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -5513,6 +5513,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
*/
set_max_sum_func_level(thd, select);
set_field(new_field);
+ depended_from= (*((Item_field**)res))->depended_from;
return 0;
}
else