Skip to content

Commit

Permalink
MDEV-24585 Assertion `je->s.cs == nice_js->charset()' failed in json_…
Browse files Browse the repository at this point in the history
…nice.

We should set the charset in
Item_func_json_format::fix_length_and_dec().
  • Loading branch information
Alexey Botchkov committed Oct 19, 2021
1 parent 5316703 commit 1a54cf6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mysql-test/r/func_json.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
6 changes: 6 additions & 0 deletions mysql-test/t/func_json.test
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,12 @@ SELECT
CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DECIMAL) AS cd;


--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 #
1 change: 1 addition & 0 deletions sql/item_jsonfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1a54cf6

Please sign in to comment.