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

MDEV-30623 JSON_TABLE in subquery not correctly marked as correlated

st_select_lex::update_correlated_cache() fails to take JSON_TABLE
functions in subqueries into account.

Reviewed by Sergei Petrunia (sergey@mariadb.com)
This commit is contained in:
Rex
2024-06-19 12:56:45 +11:00
parent e56040fee8
commit b418b60ebf
8 changed files with 181 additions and 0 deletions

View File

@ -7559,6 +7559,32 @@ Warning 1292 Truncated incorrect DECIMAL value: 'e'
drop view v1;
drop table t1, t2, t3;
#
# MDEV-30623 JSON_TABLE in subquery not correctly marked as correlated
# update_correlated_cache() fails to take JSON_TABLE functions in
# subqueries into account.
#
create table t1(c json);
insert into t1 values ('[{"x":"1"},{"x":"2"}]'),
('[{"x":"10"},{"x":"20"}]'),
('[{"x":"100"},{"x":"200"}]');
select c,
(SELECT sum(x) FROM json_table(c, "$[*]" columns( x int path "$.x"))
AS jt)
from t1;
c (SELECT sum(x) FROM json_table(c, "$[*]" columns( x int path "$.x"))
AS jt)
[{"x":"1"},{"x":"2"}] 3
[{"x":"10"},{"x":"20"}] 30
[{"x":"100"},{"x":"200"}] 300
explain select c,
(SELECT sum(x) FROM json_table(c, "$[*]" columns( x int path "$.x"))
AS jt)
from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
2 DEPENDENT SUBQUERY jt ALL NULL NULL NULL NULL 40 Table function: json_table
drop table t1;
#
# End of 10.6 tests
#
set optimizer_switch=default;