diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2021-10-11 15:05:44 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2021-10-19 11:00:56 +0400 |
commit | 1a54cf62f85044a7686dc3becfe39e6b52209484 (patch) | |
tree | 90434534c3221c11e626bc97dc6fcb57d035f0f6 | |
parent | 5316703141c00103d8f4155cf4672b1f74ca0c50 (diff) | |
download | mariadb-git-1a54cf62f85044a7686dc3becfe39e6b52209484.tar.gz |
MDEV-24585 Assertion `je->s.cs == nice_js->charset()' failed in json_nice.bb-10.2-mdev-24585-hf
We should set the charset in
Item_func_json_format::fix_length_and_dec().
-rw-r--r-- | mysql-test/r/func_json.result | 6 | ||||
-rw-r--r-- | mysql-test/t/func_json.test | 6 | ||||
-rw-r--r-- | sql/item_jsonfunc.cc | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result index 8f014c89733..f8e78c79f5d 100644 --- a/mysql-test/r/func_json.result +++ b/mysql-test/r/func_json.result @@ -934,5 +934,11 @@ CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DECIMAL) AS cd; cf cd 0 0 # +# MDEV-24585 Assertion `je->s.cs == nice_js->charset()' failed in json_nice. +# +SELECT JSON_REPLACE( JSON_DETAILED('["x"]'), '$.a', 'xx' ); +JSON_REPLACE( JSON_DETAILED('["x"]'), '$.a', 'xx' ) +["x"] +# # End of 10.2 tests # diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test index 805e9954b81..e4e093225f8 100644 --- a/mysql-test/t/func_json.test +++ b/mysql-test/t/func_json.test @@ -555,5 +555,11 @@ SELECT --echo # +--echo # MDEV-24585 Assertion `je->s.cs == nice_js->charset()' failed in json_nice. +--echo # + +SELECT JSON_REPLACE( JSON_DETAILED('["x"]'), '$.a', 'xx' ); + +--echo # --echo # End of 10.2 tests --echo # diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 7db1ae1ffaf..ea70fbeebdb 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -3534,6 +3534,7 @@ const char *Item_func_json_format::func_name() const bool Item_func_json_format::fix_length_and_dec() { decimals= 0; + collation.set(args[0]->collation); max_length= args[0]->max_length; maybe_null= 1; return FALSE; |