[MDEV-20294] SQL/JSON path doesn't unwrap Created: 2019-08-08 Updated: 2022-06-01 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | JSON |
| Affects Version/s: | 10.4.7, 10.4, 10.5 |
| Fix Version/s: | 10.4, 10.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Markus Winand | Assignee: | Rucha Deodhar |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
SQL/JSON path lax mode (default) requires unwrapping arrays in several cases, out of which MariaDB only supports the member accessor and wildcard member accessor (SQL-2:2016 3.39 General Rule 11 g 1 B I and 2 A I). MariaDB doesn't do that.
This should basically work like this:
|
| Comments |
| Comment by Alice Sherepa [ 2019-08-12 ] | ||||||||||||||||||||
|
JSON_VALUE returns a scalar, JSON_QUERY returns an object or an array. It does not look so neat, but:
| ||||||||||||||||||||
| Comment by Markus Winand [ 2019-08-13 ] | ||||||||||||||||||||
|
The point of unwrap in SQL/JSON path lax mode is to cope with JSON whos structure may vary in such a way that some documents contains an array with (possibly) multiple entries, but those that have only a single entry might lack the array. e.g. The SQL/JSON path expression '$.a.b' should return 9 for both of these documents:
| ||||||||||||||||||||
| Comment by Elena Stepanova [ 2020-04-28 ] | ||||||||||||||||||||
|
Here is an example of the same issue as reported, but this one is directly from the standard:
According to the standard, it should return the value Connie. But it returns NULL instead:
|