[MDEV-28922] JSON_NORMALIZE handling of duplicate keys Created: 2022-06-21 Updated: 2023-11-28 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | JSON |
| Affects Version/s: | 10.7, 10.8, 10.9 |
| Fix Version/s: | 10.11 |
| Type: | Bug | Priority: | Major |
| Reporter: | Wayne Davison (Inactive) | Assignee: | Vicențiu Ciorbaru |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
There is a bug in the processing of JSON_NORMALIZE() due to the fact that the sort algorithm isn't stable (it doesn't guarantee that duplicates in the input remain in input order). For instance:
Results in:
Given that duplicate key values are inaccessible via path expressions, I expected JSON_NORMALIZE() to remove duplicate keys so that {"a": 1, "a": 2}and {"a": 1}would produce the same JSON_NORMALIZE() output (and thus also be JSON_EQUAL()). If this isn't desirable for some reason, the sort must at least be stable so that the extracted values don't jump around. |
| Comments |
| Comment by Wayne Davison (Inactive) [ 2022-06-21 ] |
|
A case could also be made to have JSON_COMPACT() remove duplicate keys. |