Bug #70567 JSON_VALID is too strict for some of objects
Submitted: 9 Oct 2013 18:37 Modified: 19 Dec 2013 0:03
Reporter: Sveta Smirnova Email Updates:
Status: Closed Impact on me:
None 
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 18:37] Sveta Smirnova
Description:
JSON_VALID rejects following values:

[1], ["a"], [1,{"a":"bc"}]

But according to http://www.ietf.org/rfc/rfc4627.txt?number=4627 it should not

Even more, debug build crashes on json_valid('[1,{"a":"bc"}]')

How to repeat:
mysql> select json_valid('[1]');
+-------------------+
| json_valid('[1]') |
+-------------------+
|                 0 |
+-------------------+
1 row in set (0.00 sec)

mysql> select json_valid('["a"]');
+---------------------+
| json_valid('["a"]') |
+---------------------+
|                   0 |
+---------------------+
1 row in set (0.00 sec)

mysql> select json_valid('[1,{"a":"bc"}]');
ERROR 2013 (HY000): Lost connection to MySQL server during query
[9 Oct 2013 22:13] Sveta Smirnova
Sorry, in last example I used wrong UDF binary. With correct binary result is still wrong, but no crash occurs:

mysql> select json_valid('[1,{"a":"bc"}]');
+------------------------------+
| json_valid('[1,{"a":"bc"}]') |
+------------------------------+
|                            0 |
+------------------------------+
1 row in set (0.00 sec)
[19 Dec 2013 0:03] Sveta Smirnova
Posted by developer:
 
Fixed in versions 0.3.0 and 0.2.2