| Bug #70574 | JSON_MERGE treats document without opening bracket as valid | ||
|---|---|---|---|
| Submitted: | 9 Oct 2013 19:23 | Modified: | 6 Nov 2013 18:21 |
| Reporter: | Sveta Smirnova | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: JSON User-defined function ( UDF ) | Severity: | S3 (Non-critical) |
| Version: | 0.2 | OS: | Any |
| Assigned to: | Sveta Smirnova | CPU Architecture: | Any |
[9 Oct 2013 22:12]
Sveta Smirnova
Sorry: used outdated udf binary. With correct binary results are still wrong, but in different way:
mysql> select json_merge('[1,2]', '[3,4,5]' );
+---------------------------------+
| json_merge('[1,2]', '[3,4,5]' ) |
+---------------------------------+
| [1,2] |
+---------------------------------+
1 row in set (0.00 sec)
mysql> select json_merge('"a":"b"}', '{"c":"d"}' );
+--------------------------------------+
| json_merge('"a":"b"}', '{"c":"d"}' ) |
+--------------------------------------+
| "a":"b", "c":"d"} |
+--------------------------------------+
1 row in set (0.00 sec)
mysql> select json_merge('"a":"b"}', '{"c":"d"}' );
+--------------------------------------+
| json_merge('"a":"b"}', '{"c":"d"}' ) |
+--------------------------------------+
| "a":"b", "c":"d"} |
+--------------------------------------+
1 row in set (0.00 sec)
[6 Nov 2013 18:20]
Sveta Smirnova
Posted by developer: Fixed in versions 0.2.1 and 0.3.0

Description: README file says that if the first document does not contain opening curly bracket, JSON_MERGE should return NULL. But it does not. How to repeat: mysql> select json_merge('"a":"b"}', '{"c":"d"}' )\G *************************** 1. row *************************** json_merge('"a":"b"}', '{"c":"d"}' ): { } A user reports different output: mysql> select json_merge('"a":"b"}', '{"c":"d"}' )\G *************************** 1. row *************************** json_merge('"a":"b"}', '{"c":"d"}' ): "a":"b", "c":"d"} (http://blog.ulf-wendel.de/2013/mysql-5-7-sql-functions-for-json-udf/)