Bug #79643 | Empty strings as keys probably not handled correctly by json_extract() | ||
---|---|---|---|
Submitted: | 14 Dec 2015 22:48 | Modified: | 20 Jan 2016 12:30 |
Reporter: | Pawel Mroszczyk | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: JSON | Severity: | S3 (Non-critical) |
Version: | OS: | Any | |
Assigned to: | CPU Architecture: | Any |
[14 Dec 2015 22:48]
Pawel Mroszczyk
[21 Dec 2015 11:12]
Knut Anders Hatlen
Hi Pawel, I believe the unquoted variants ('$.', '$.....', etc) should cause an error to be raised. According to https://dev.mysql.com/doc/refman/5.7/en/json-path-syntax.html, unquoted key names in JSON paths must be ECMAScript identifiers. An empty string cannot be an identifier, if I read the ECMAScript specification correctly. I don't see any reason to reject the quoted variants, though. Since JSON objects can be created with empty key names, it should be possible to construct paths with empty key names.
[20 Jan 2016 12:30]
Jon Stephens
Documented fix in the MySQL 5.8.0 changelog, as follows: The empty string is now accepted as a key when used as such with JSON functions. In this case, it must be quoted. Closed.