[MDEV-30466] Extracting value from a JSON array using JSON_EXTRACT inconsistent among versions Created: 2023-01-25 Updated: 2023-01-25 Resolved: 2023-01-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | JSON |
| Affects Version/s: | 10.9.0, 10.10.2 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | AR | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Environment: |
mac os monterey v12.1 |
||
| Issue Links: |
|
||||||||
| Description |
Step1: Create tableCREATE TABLE IF NOT EXISTS brands ( Step2: Insert values into tableINSERT INTO brands (name, sold) , {"id":"1","name":"1","count":5000}]'), , {"id":"1","name":"1","count":10000}]'), , {"id":"1","name":"1","count":15000}]'), , {"id":"1","name":"1","count":700}]'); Step3: Extract values using querySELECT name, JSON_EXTRACT(sold, '$[*].count') as cnt FROM brands; Output is incorrect when running V10.9 and above:
Output is correct when running V10.8 and below:
Test fiddle here: https://dbfiddle.uk/0A5oD29V |
| Comments |
| Comment by Alice Sherepa [ 2023-01-25 ] |
|
Thank you for the report! |