[MDEV-30623] JSON_TABLE in subquery not working Created: 2023-02-09 Updated: 2023-11-28 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | JSON, Optimizer |
| Affects Version/s: | 10.6.11, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11 |
| Fix Version/s: | 10.6, 10.11 |
| Type: | Bug | Priority: | Major |
| Reporter: | Thomas G. Jensen | Assignee: | Rex Johnston |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | JSON_TABLE, optimizer-easy | ||
| Description |
|
Gives the result:
In the subquery the t2_json column from first row is used on every row. |
| Comments |
| Comment by Alice Sherepa [ 2023-02-14 ] | |||||||||||||||||||||||||||||||||||
|
Thank you for the report!
| |||||||||||||||||||||||||||||||||||
| Comment by clint chenery [ 2023-10-04 ] | |||||||||||||||||||||||||||||||||||
|
I have the same issue as this with MariaDb 10.6, i have worked around it by creating a custom function containing the json_table command that is used in place of the subquery and then passing the JSON column to the function which returns some value | |||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2023-10-04 ] | |||||||||||||||||||||||||||||||||||
|
The subquery uses JSON_TABLE and its first parameter JSON_TABLE(t2_json is a reference to outside the subquery:
But EXPLAIN output in the first comment shows type=SUBQUERY, which means the optimizer thinks the subquery is not correlated. Could the cause be that the code that collects subquery's outside references doesn't check table function's parameters? And the fix would be to check them? | |||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2023-10-26 ] | |||||||||||||||||||||||||||||||||||
|
|