MySQL Forums
Forum List  »  Docs

Error in MySQL documentation JSON_VALUE
Posted by: Derek Wolfe
Date: November 27, 2024 11:03AM

The documentation is incorrect in that is states the following 2 statements are equivalent.

SELECT JSON_VALUE(json_doc, path RETURNING type);
SELECT CAST(JSON_UNQUOTE(JSON_EXTRACT(json_doc, path)) AS type);

This is incorrect due to how JSON_EXTRACT and JSON_VALUE treat null values differently. This can be easily shown:

SET @object = JSON_OBJECT('index', null);

SELECT JSON_VALUE(@object, '$.index' RETURNING char);
SELECT CAST(JSON_UNQUOTE(JSON_EXTRACT(@object, '$.index')) AS char);

Options: ReplyQuote


Subject
Views
Written By
Posted
Error in MySQL documentation JSON_VALUE
86
November 27, 2024 11:03AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.