[MDEV-13324] JSON_SET returns NULL instead of object Created: 2017-07-14  Updated: 2017-09-12  Resolved: 2017-09-12

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.2
Fix Version/s: 10.2.9

Type: Bug Priority: Major
Reporter: Ian Gilfillan Assignee: Alexey Botchkov
Resolution: Fixed Votes: 1
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-13323 json_set returns NULL instead of object Closed

 Description   

In MySQL 5.7:

SELECT JSON_SET('{}', '$.age', 87); 
+-----------------------------+
| JSON_SET('{}', '$.age', 87) |
+-----------------------------+
| {"age": 87}                 |
+-----------------------------+

In MariaDB 10.2:

SELECT JSON_SET('{}', '$.age', 87); 
+-----------------------------+
| JSON_SET('{}', '$.age', 87) |
+-----------------------------+
| NULL                        |
+-----------------------------+



 Comments   
Comment by Alice Sherepa [ 2017-07-14 ]

reproduced on 10.2.7

SELECT JSON_SET('{}', '$.age', 87)
+-----------------------------+
| JSON_SET('{}', '$.age', 87) |
+-----------------------------+
| NULL                        |
+-----------------------------+
1 row in set, 1 warning (0.00 sec)
Warning (Code 4038): Syntax error in JSON text in argument 1 to function 'json_set' at position 2
 
MariaDB [test]> SELECT JSON_VALID('{}');
--------------
SELECT JSON_VALID('{}')
+------------------+
| JSON_VALID('{}') |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)

Comment by Steven WdV [ 2017-09-04 ]

Confirmed for MariaDB 10.3.1 Alpha, an other example would be:

SELECT JSON_ARRAY_APPEND('[]', '$', 42)
--returns NULL, should return '[42]'

Also, the Issue Links section states this issue duplicates MDEV-13323, while it should be is duplicated by MDEV-13323

Generated at Thu Feb 08 08:04:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.