Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.9.2
-
None
Description
The sequence of statements below yields a strange result, in particular it is also different from previous MariaDB versions (namely, 10.8.3).
I believe the wildcard member accessory should always apply an auto-wrap, but the but I get one row wrapped, the second one not. I would expect both being wrapped, thus instead of "20" I'd expect "[20]".
MariaDB 5.5.5-10.9.2-MariaDB> CREATE TABLE demo_json_z2o1 ( |
-> id NUMERIC NOT NULL, |
-> j VARCHAR(255) |
-> );
|
Query OK, 0 rows affected (0.00 sec) |
|
|
MariaDB 5.5.5-10.9.2-MariaDB> INSERT INTO demo_json_z2o1 (id, j) VALUES (1,'{"a": 10}'); |
Query OK, 1 row affected (0.00 sec)
|
|
|
MariaDB 5.5.5-10.9.2-MariaDB> INSERT INTO demo_json_z2o1 (id, j) VALUES (2,'{"b": 20}'); |
Query OK, 1 row affected (0.00 sec)
|
|
|
MariaDB 5.5.5-10.9.2-MariaDB> SELECT id |
-> , JSON_EXTRACT(j, '$.*') val |
-> FROM demo_json_z2o1 |
-> ORDER BY id; |
+----+------+ |
| id | val |
|
+----+------+ |
| 1 | [10] |
|
| 2 | 20 |
|
+----+------+ |
2 rows in set (0.00 sec) |
|
|
MariaDB 5.5.5-10.9.2-MariaDB>
|