mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-18886 JSON_ARRAY() does not recognise JSON argument.
JSON_ARRAY and JSON_OBJECT functions with no arguments now get the connection charset. Item_func_convert_charset returns the correct is_json() flag.
This commit is contained in:
@ -830,3 +830,15 @@ SET sql_mode=default;
|
|||||||
select JSON_VALID( '{"a":1]' );
|
select JSON_VALID( '{"a":1]' );
|
||||||
JSON_VALID( '{"a":1]' )
|
JSON_VALID( '{"a":1]' )
|
||||||
0
|
0
|
||||||
|
#
|
||||||
|
# MDEV-18886 JSON_ARRAY() does not recognise JSON argument.
|
||||||
|
#
|
||||||
|
SELECT JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket'));
|
||||||
|
JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket'))
|
||||||
|
["str", {"plugin": "unix_socket"}]
|
||||||
|
SELECT CHARSET(JSON_ARRAY());
|
||||||
|
CHARSET(JSON_ARRAY())
|
||||||
|
latin1
|
||||||
|
SELECT CHARSET(JSON_OBJECT());
|
||||||
|
CHARSET(JSON_OBJECT())
|
||||||
|
latin1
|
||||||
|
@ -487,3 +487,10 @@ SET sql_mode=default;
|
|||||||
|
|
||||||
select JSON_VALID( '{"a":1]' );
|
select JSON_VALID( '{"a":1]' );
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-18886 JSON_ARRAY() does not recognise JSON argument.
|
||||||
|
--echo #
|
||||||
|
SELECT JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket'));
|
||||||
|
SELECT CHARSET(JSON_ARRAY());
|
||||||
|
SELECT CHARSET(JSON_OBJECT());
|
||||||
|
|
||||||
|
@ -1488,9 +1488,10 @@ bool Item_func_json_array::fix_length_and_dec()
|
|||||||
|
|
||||||
if (arg_count == 0)
|
if (arg_count == 0)
|
||||||
{
|
{
|
||||||
collation.set(&my_charset_utf8_general_ci,
|
THD* thd= current_thd;
|
||||||
|
collation.set(thd->variables.collation_connection,
|
||||||
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
|
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
|
||||||
tmp_val.set_charset(&my_charset_utf8_general_ci);
|
tmp_val.set_charset(thd->variables.collation_connection);
|
||||||
max_length= 2;
|
max_length= 2;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1192,6 +1192,7 @@ public:
|
|||||||
(cs->state & MY_CS_UNICODE));
|
(cs->state & MY_CS_UNICODE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool is_json_type() { return args[0]->is_json_type(); }
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
longlong val_int()
|
longlong val_int()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user