diff options
author | Weijun-H <huangweijun1001@gmail.com> | 2023-01-08 08:43:02 +0000 |
---|---|---|
committer | Weijun-H <huangweijun1001@gmail.com> | 2023-01-12 17:51:42 +0000 |
commit | 12618cfb28cb2843dc74bb3a176dae76acdb698a (patch) | |
tree | bbd6cde23668acb7f33e52ebf03762f7fd54c868 | |
parent | 17920291a661d3d2b02a9261293caebc7158d38a (diff) | |
download | mariadb-git-12618cfb28cb2843dc74bb3a176dae76acdb698a.tar.gz |
MDEV-19160 json_pretty() alias for json_detailed()
-rw-r--r-- | mysql-test/main/func_json.result | 31 | ||||
-rw-r--r-- | mysql-test/main/func_json.test | 1 | ||||
-rw-r--r-- | sql/item_create.cc | 1 |
3 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 400ecdbfc36..1e59256b517 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1253,6 +1253,37 @@ JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) ["123"] } ] +select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200; +JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) +[ + { + "range_scan_alternatives": + [ + { + "index": "a_b", + "ranges": + [ + "2 <= a <= 2 AND 4 <= b <= 4", + "123" + ], + "rowid_ordered": true, + "using_mrr": false, + "index_only": true, + "rows": 1, + "cost": 1.1752, + "chosen": true + } + ], + "analyzing_roworder_intersect": + { + "cause": "too few roworder scans" + }, + "analyzing_index_merge_union": + [], + "test_one_line_array": + ["123"] + } +] select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200; JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) [{"range_scan_alternatives": [{"index": "a_b", "ranges": ["2 <= a <= 2 AND 4 <= b <= 4", "123"], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true}], "analyzing_roworder_intersect": {"cause": "too few roworder scans"}, "analyzing_index_merge_union": [], "test_one_line_array": ["123"]}] diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 743f97fedc1..b3e19f76972 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -812,6 +812,7 @@ insert into t200 values select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200; +select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200; select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200; drop table t200; diff --git a/sql/item_create.cc b/sql/item_create.cc index a5b882e2b91..2dfbc1d2021 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -7351,6 +7351,7 @@ Native_func_registry func_array[] = { { STRING_WITH_LEN("JSON_CONTAINS_PATH") }, BUILDER(Create_func_json_contains_path)}, { { STRING_WITH_LEN("JSON_DEPTH") }, BUILDER(Create_func_json_depth)}, { { STRING_WITH_LEN("JSON_DETAILED") }, BUILDER(Create_func_json_detailed)}, + { { STRING_WITH_LEN("JSON_PRETTY") }, BUILDER(Create_func_json_detailed)}, { { STRING_WITH_LEN("JSON_EXISTS") }, BUILDER(Create_func_json_exists)}, { { STRING_WITH_LEN("JSON_EXTRACT") }, BUILDER(Create_func_json_extract)}, { { STRING_WITH_LEN("JSON_INSERT") }, BUILDER(Create_func_json_insert)}, |