From 5879bdf9e2f9f1e521d138daebab70f8fa143a66 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Mon, 20 Jun 2022 15:36:21 +0800 Subject: [PATCH] json-functions: Update status and links (#8762) (#9022) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * json-functions: Update status and links * Fix dead anchor Co-authored-by: Daniƫl van Eeden --- functions-and-operators/json-functions.md | 25 ++++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/functions-and-operators/json-functions.md b/functions-and-operators/json-functions.md index 43d765cbff552..9bd8059a41ee3 100644 --- a/functions-and-operators/json-functions.md +++ b/functions-and-operators/json-functions.md @@ -9,7 +9,7 @@ summary: Learn about JSON functions. > > This is still an experimental feature. It is **NOT** recommended that you use it in the production environment. -TiDB supports most of the JSON functions that shipped with the GA release of MySQL 5.7. Additional JSON functions were added to MySQL 5.7 after its release, and not all are available in TiDB (see [unsupported functions](#unsupported-functions)). +TiDB supports most of the JSON functions that shipped with the GA release of MySQL 5.7. ## Functions that create JSON values @@ -40,6 +40,7 @@ TiDB supports most of the JSON functions that shipped with the GA release of MyS | [JSON_ARRAY_INSERT(json_doc, path, val[, path, val] ...)][json_array_insert] | Inserts an array into the json document and returns the modified document | | [JSON_INSERT(json_doc, path, val[, path, val] ...)][json_insert] | Inserts data into a JSON document and returns the result | | [JSON_MERGE(json_doc, json_doc[, json_doc] ...)][json_merge] | A deprecated alias for `JSON_MERGE_PRESERVE` | +| [JSON_MERGE_PATCH(json_doc, json_doc[, json_doc] ...)][json_merge_patch] | Merge JSON documents | | [JSON_MERGE_PRESERVE(json_doc, json_doc[, json_doc] ...)][json_merge_preserve] | Merges two or more JSON documents and returns the merged result | | [JSON_REMOVE(json_doc, path[, path] ...)][json_remove] | Removes data from a JSON document and returns the result | | [JSON_REPLACE(json_doc, path, val[, path, val] ...)][json_replace] | Replaces existing values in a JSON document and returns the result | @@ -55,28 +56,22 @@ TiDB supports most of the JSON functions that shipped with the GA release of MyS | [JSON_DEPTH(json_doc)][json_depth] | Returns the maximum depth of a JSON document | | [JSON_LENGTH(json_doc[, path])][json_length] | Returns the length of a JSON document, or, if a path argument is given, the length of the value within the path | | [JSON_TYPE(json_val)][json_type] | Returns a string indicating the type of a JSON value | -| [JSON_VALID(json_doc)][json_valid] | Checks if a json_doc is valid JSON. Useful for checking a column before converting it to the json type. | +| [JSON_VALID(json_doc)][json_valid] | Checks if a json\_doc is valid JSON. Useful for checking a column before converting it to the json type. | ## Utility Functions | Function Name | Description | | --------------------------------- | ----------- | +| [JSON_PRETTY(json_doc)][json_pretty] | Pretty formatting of a JSON document | | [JSON_STORAGE_SIZE(json_doc)][json_storage_size] | Returns an approximate size of bytes required to store the json value. As the size does not account for TiKV using compression, the output of this function is not strictly compatible with MySQL. | ## Aggregate Functions | Function Name | Description | | --------------------------------- | ----------- | +| [JSON_ARRAYAGG(key)][json_arrayagg] | Provides an aggregation of keys. | | [JSON_OBJECTAGG(key, value)][json_objectagg] | Provides an aggregation of values for a given key. | -## Unsupported functions - -The following JSON functions are unsupported in TiDB. You can track the progress in adding them in [TiDB #7546](https://github.com/pingcap/tidb/issues/7546): - -* `JSON_MERGE_PATCH` -* `JSON_PRETTY` -* `JSON_ARRAYAGG` - ## See also * [JSON Function Reference](https://dev.mysql.com/doc/refman/5.7/en/json-function-reference.html) @@ -102,6 +97,8 @@ The following JSON functions are unsupported in TiDB. You can track the progress [json_merge]: https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-merge +[json_merge_patch]: https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-merge-patch + [json_merge_preserve]: https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-merge-preserve [json_object]: https://dev.mysql.com/doc/refman/5.7/en/json-creation-functions.html#function_json-object @@ -131,3 +128,11 @@ The following JSON functions are unsupported in TiDB. You can track the progress [json_array_append]: https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-array-append [json_array_insert]: https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-array-insert + +[json_arrayagg]: https://dev.mysql.com/doc/refman/5.7/en/aggregate-functions.html#function_json-arrayagg + +[json_objectagg]: https://dev.mysql.com/doc/refman/5.7/en/aggregate-functions.html#function_json-objectagg + +[json_pretty]: https://dev.mysql.com/doc/refman/5.7/en/json-utility-functions.html#function_json-pretty + +[json_storage_size]: https://dev.mysql.com/doc/refman/5.7/en/json-utility-functions.html#function_json-storage-size