mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-21102: Server crashes in JOIN_CACHE::write_record_data upon EXPLAIN with subqueries
JOIN_CACHE has a light-weight initialization mode that's targeted at EXPLAINs. In that mode, JOIN_CACHE objects are not able to execute. Light-weight mode was used whenever the statement was an EXPLAIN. However the EXPLAIN can execute subqueries, provided they enumerate less than @@expensive_subquery_limit rows. Make sure we use light-weight initialization mode only when the select is more expensive @@expensive_subquery_limit. Also add an assert into JOIN_CACHE::put_record() which prevents its use if it was initialized for EXPLAIN only.
This commit is contained in:
@ -1589,6 +1589,7 @@ bool JOIN_CACHE::put_record()
|
||||
{
|
||||
bool is_full;
|
||||
uchar *link= 0;
|
||||
DBUG_ASSERT(!for_explain_only);
|
||||
if (prev_cache)
|
||||
link= prev_cache->get_curr_rec_link();
|
||||
write_record_data(link, &is_full);
|
||||
|
Reference in New Issue
Block a user