summaryrefslogtreecommitdiff
path: root/sql/item_jsonfunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_jsonfunc.cc')
-rw-r--r--sql/item_jsonfunc.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index 4a837646451..1da53935441 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -1621,13 +1621,15 @@ String *Item_func_json_array_append::val_str(String *str)
if (je.value_type == JSON_VALUE_ARRAY)
{
- if (json_skip_level(&je))
+ int n_items;
+ if (json_skip_level_and_count(&je, &n_items))
goto js_error;
ar_end= je.s.c_str - je.sav_c_len;
str_rest_len= js->length() - (ar_end - (const uchar *) js->ptr());
str->q_append(js->ptr(), ar_end-(const uchar *) js->ptr());
- str->append(", ", 2);
+ if (n_items)
+ str->append(", ", 2);
if (append_json_value(str, args[n_arg+1], &tmp_val))
goto return_null; /* Out of memory. */