1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-25381: JSON_TABLE: ER_WRONG_OUTER_JOIN upon query with LEFT and RIGHT joins and view

Table_function_json_table::m_dep_tables attempts to cache the value of
m_json->used_tables(), poorly. Remove the cache and use the value
directly.
This commit is contained in:
Sergei Petrunia
2021-04-12 16:43:45 +03:00
committed by Alexey Botchkov
parent 4a10dd0253
commit 6bac48d0cf
4 changed files with 95 additions and 28 deletions

View File

@ -208,8 +208,16 @@ public:
st_select_lex *new_parent, bool merge);
void update_used_tables() { m_json->update_used_tables(); }
table_map used_tables() const { return m_dep_tables; }
bool join_cache_allowed() const { return !m_dep_tables; }
table_map used_tables() const { return m_json->used_tables(); }
bool join_cache_allowed() const
{
/*
Can use join cache when we have an outside reference.
If there's dependency on any other table or randomness,
cannot use it.
*/
return !(used_tables() & ~OUTER_REF_TABLE_BIT);
}
void get_estimates(ha_rows *out_rows,
double *scan_time, double *startup_cost);
@ -242,13 +250,6 @@ private:
/* Context to be used for resolving the first argument. */
Name_resolution_context *m_context;
/*
the JSON argument can be taken from other tables.
We have to mark these tables as dependent so the
mask of these dependent tables is calculated in ::setup().
*/
table_map m_dep_tables;
/* Current NESTED PATH level being parsed */
Json_table_nested_path *cur_parent;