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

MDEV-25202: JSON_TABLE: Early table reference leads to unexpected result set

(Also fixes MDEV-25254).
Re-work Name Resolution for the argument of JSON_TABLE(json_doc, ....)
function. The json_doc argument can refer to other tables, but it can
only refer to the tables that precede[*] the JSON_TABLE(...) call.

[*] - For queries with RIGHT JOINs, the "preceding" is determined after
the query is normalized by converting RIGHT JOIN into left one.

The implementation is as follows:
- Table function arguments use their own Name_resolution_context.

- The Name_resolution_context now has a bitmap of tables that should be
  ignored when searching for a field.

- get_disallowed_table_deps() walks the TABLE_LIST::nested_join tree
  and computes a bitmap of tables that do not "precede" the given
  JSON_TABLE(...) invocation  (according the above definition of
  "preceding").
This commit is contained in:
Sergei Petrunia
2021-04-05 14:15:05 +03:00
committed by Alexey Botchkov
parent 13390a70e2
commit 84cf9c2e11
16 changed files with 398 additions and 39 deletions

View File

@ -9007,6 +9007,10 @@ bool st_select_lex_unit::add_fake_select_lex(THD *thd_arg)
@param left_op left operand of the JOIN
@param right_op rigth operand of the JOIN
@seealso
push_table_function_arg_context() serves similar purpose for table
functions
@retval
FALSE if all is OK
@retval