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

MDEV-25380: JSON_TABLE: Assertion `join->best_read < double(1.797...) fails

The query used a subquery of this form:

SELECT ...
WHERE
   EXISTS( SELECT ...
           FROM JSON_TABLE(outer_ref, ..) as JT
           WHERE trivial_correlation_cond)

EXISTS-to-IN conversion code was unable to see that the subquery will
still be correlated after the trivial_correlation is removed, which
eventually caused a crash due to inability to construct a query plan.

Fixed by making Item_subselect::walk() also walk arguments of Table
Functions.
This commit is contained in:
Sergei Petrunia
2021-04-12 14:11:37 +03:00
committed by Alexey Botchkov
parent eb2550ee78
commit 4a10dd0253
5 changed files with 75 additions and 0 deletions

View File

@ -1341,6 +1341,12 @@ int Table_function_json_table::setup(THD *thd, TABLE_LIST *sql_table,
return FALSE;
}
int Table_function_json_table::walk_items(Item_processor processor,
bool walk_subquery, void *argument)
{
return m_json->walk(processor, walk_subquery, argument);
}
void Table_function_json_table::get_estimates(ha_rows *out_rows,
double *scan_time,
double *startup_cost)