[MDEV-30343] Optimizer trace produces JSON too deep for MariaDB JSON functions Created: 2023-01-04 Updated: 2023-11-28 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | JSON |
| Affects Version/s: | 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11 |
| Fix Version/s: | 10.4, 10.5, 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
With a fairly ordinary query optimizer trace can produce a trace which breaches the limit of nested structures hardcoded to 32, and thus becomes invalid JSON from the inbuilt functions' perspective. The example below uses a query with 11 joins and no other conditions. With a bit more complicated queries I think it can be achieved with even less joins.
The actual (well-concealed) problem is
The deeply-nested part is this:
I'm not sure what should be done about it. It seems clearly wrong that one part of the server legitimately produces a JSON structure which another part of the server cannot handle. Maybe it should be a two-fold solution – to increase the limit to cover the realistic traces the optimizer trace can produce (it will require an input from the optimizer team), and then forbid creating traces which exceed the limit, e.g. by adding a JSON_VALID check to the trace column. |