[MDEV-29751] JSON_EXTRACT produces weird "null" value Created: 2022-10-10 Updated: 2023-11-28 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Subquery, Server |
| Affects Version/s: | 10.3, 10.4, 10.9.3, 10.5, 10.6, 10.7, 10.8, 10.9 |
| Fix Version/s: | 10.4, 10.5, 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Lukas Eder | Assignee: | Rucha Deodhar |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Try this query:
It produces this result:
Both UNION ALL subqueries should produce the same results, and they do in MySQL, but don't in MariaDB. The problem is that JSON_EXTRACT seems to produce a '"null"' JSON string value that is equal to a 'null' SQL string in some cases, but not in others. The query shows that a workaround is to wrap the JSON_EXTRACT calls in a subquery. Another workaround is to concatenate the JSON_EXTRACT result to '', to remove the weird JSON behaviour:
In the long run, I really wish MariaDB just introduced a formal JSON type, like PostgreSQL did from the beginning, or Oracle / MySQL did after the fact. |
| Comments |
| Comment by Alice Sherepa [ 2022-10-13 ] | |||||||||||||||
|
Thanks! I repeated as described, there are extra double quotes:
|