Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-41581

Assertion `field_charset() == cs' in Field_blob::handle_group_concat on GROUP_CONCAT ... ORDER BY over a JSON-typed expression

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 13.3
    • 13.3
    • JSON
    • Not for Release Notes
    • Q1/2027 Server Maintenance

    Description

      CREATE TABLE t (a INT);
      INSERT INTO t VALUES (1);
      SELECT GROUP_CONCAT(CAST(a AS JSON) ORDER BY 1) FROM t;
      

      Leads to

      MDEV-38740 CS 13.2.0 49efccb222e2370690b4de0416817fa35f9da2ea (Debug, Clang 18.1.3-11) Build 15/10/2026

      mariadbd: /test/mtest/MDEV-38740/pr5263_dbg/sql/field.cc:8981: int Field_blob::handle_group_concat(const char *, size_t, CHARSET_INFO *, bool): Assertion `field_charset() == cs' failed.
      

      MDEV-38740 CS 13.2.0 49efccb222e2370690b4de0416817fa35f9da2ea (Debug, Clang 18.1.3-11) Build 15/10/2026

      Core was generated by `/test/mtest/MDEV-38740/MD151026-mariadb-13.2.0-linux-x86_64-dbg/bin/mariadbd --'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 206574)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x000074b351a4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000074b351a288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000074b351a2881b in __assert_fail_base (fmt=0x74b351bd1208 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x60729165d10a "field_charset() == cs", file=file@entry=0x60729165a09e "/test/mtest/MDEV-38740/pr5263_dbg/sql/field.cc", line=line@entry=8981, function=function@entry=0x60729165d0ba "int Field_blob::handle_group_concat(const char *, size_t, CHARSET_INFO *, bool)") at ./assert/assert.c:96
      #6  0x000074b351a3b517 in __assert_fail (assertion=0x60729165d10a "field_charset() == cs", file=0x60729165a09e "/test/mtest/MDEV-38740/pr5263_dbg/sql/field.cc", line=8981, function=0x60729165d0ba "int Field_blob::handle_group_concat(const char *, size_t, CHARSET_INFO *, bool)") at ./assert/assert.c:105
      #7  0x0000607290878170 in Field_blob::handle_group_concat (this=0x6cb23807a6e0, from=0x6cb238016550 "1\245\245\245\245\245\245\2455", length=1, cs=0x6072befff948, with_zero_prefix=false)at /test/mtest/MDEV-38740/pr5263_dbg/sql/field.cc:8981
      #8  0x000060729087850c in Field_blob::store (this=0x6cb23807a6e0, from=0x6cb238016550 "1\245\245\245\245\245\245\2455", length=1, cs=0x6072befff948) at /test/mtest/MDEV-38740/pr5263_dbg/sql/field.cc:9038
      #9  0x000060729153c493 in Field_json::store (this=0x6cb23807a6e0, from=0x6cb238016550 "1\245\245\245\245\245\245\2455", length=1, cs=0x6072befff948)at /test/mtest/MDEV-38740/pr5263_dbg/plugin/type_json/sql_type_json.cc:252
      #10 0x00006072908da13b in Item::save_str_in_field (this=0x6cb23801acb0, field=0x6cb23807a6e0, no_conversions=true)at /test/mtest/MDEV-38740/pr5263_dbg/sql/item.cc:7512
      #11 0x00006072907234e0 in Type_handler_string_result::Item_save_in_field (this=0x607292b8dab8 <type_handler_json>, item=0x6cb23801acb0, field=0x6cb23807a6e0, no_conversions=true)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_type.cc:4556
      #12 0x00006072908da6c5 in Item::save_in_field (this=0x6cb23801acb0, field=0x6cb23807a6e0, no_conversions=true)at /test/mtest/MDEV-38740/pr5263_dbg/sql/item.cc:7586
      #13 0x0000607290289791 in Item_result_field::save_in_result_field (this=0x6cb23801acb0, no_conversions=true)at /test/mtest/MDEV-38740/pr5263_dbg/sql/item.h:3745
      #14 0x00006072904e5ad8 in copy_funcs (func_ptr=0x6cb23807a1f0, thd=0x6cb238000d60)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_select.cc:31341
      #15 0x0000607290a0e6f3 in Item_func_group_concat::add (this=0x6cb23801af20, exclude_nulls=true)at /test/mtest/MDEV-38740/pr5263_dbg/sql/item_sum.cc:4588
      #16 0x00006072906c8d9c in Item_func_group_concat::add (this=0x6cb23801af20)at /test/mtest/MDEV-38740/pr5263_dbg/sql/item_sum.h:2237
      #17 0x0000607290a12dbd in Aggregator_simple::add (this=0x6cb23801efd0)at /test/mtest/MDEV-38740/pr5263_dbg/sql/item_sum.h:773
      #18 0x000060729028f5ed in Item_sum::aggregator_add (this=0x6cb23801af20)at /test/mtest/MDEV-38740/pr5263_dbg/sql/item_sum.h:605
      #19 0x0000607290289032 in Item_sum::reset_and_add (this=0x6cb23801af20)at /test/mtest/MDEV-38740/pr5263_dbg/sql/item_sum.h:484
      #20 0x00006072904e56ca in init_sum_functions (func_ptr=0x6cb23801cf40, end_ptr=0x6cb23801cf48)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_select.cc:31293
      #21 0x00006072904e2d53 in end_send_group (join=0x6cb23801c5e0, join_tab=0x6cb23801e268, end_of_records=false)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_select.cc:27215
      #22 0x00006072904e380d in evaluate_join_record (join=0x6cb23801c5e0, join_tab=0x6cb23801ddf0, error=0)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_select.cc:25808
      #23 0x0000607290492e7e in sub_select (join=0x6cb23801c5e0, join_tab=0x6cb23801ddf0, end_of_records=false)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_select.cc:25575
      #24 0x00006072904baa65 in do_select (join=0x6cb23801c5e0, procedure=0x0)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_select.cc:25086
      #25 0x00006072904b9e11 in JOIN::exec_inner (this=0x6cb23801c5e0)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_select.cc:5147
      #26 0x00006072904b9010 in JOIN::exec (this=0x6cb23801c5e0)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_select.cc:4935
      #27 0x000060729049375c in mysql_select (thd=0x6cb238000d60, tables=0x6cb23801b4c0, fields=@0x6cb23801a928: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x6cb23801b3d0, last = 0x6cb23801b3d0, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x6cb23801c5b0, unit=0x6cb2380052f8, select_lex=0x6cb23801a670)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_select.cc:5461
      #28 0x0000607290493235 in handle_select (thd=0x6cb238000d60, lex=0x6cb238005218, result=0x6cb23801c5b0, setup_tables_done_option=0)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_select.cc:652
      #29 0x000060729042f10d in execute_sqlcom_select (thd=0x6cb238000d60, all_tables=0x6cb23801b4c0)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_parse.cc:6266
      #30 0x0000607290423c36 in mysql_execute_command (thd=0x6cb238000d60, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_parse.cc:4038
      #31 0x000060729041bc24 in mysql_parse (thd=0x6cb238000d60, rawbuf=0x6cb23801a5a0 "SELECT GROUP_CONCAT(CAST(a AS JSON) ORDER BY 1) FROM t", length=54, parser_state=0x74b350294a80)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_parse.cc:8005
      #32 0x0000607290418fed in dispatch_command (command=COM_QUERY, thd=0x6cb238000d60, packet=0x6cb23800b7d1 "", packet_length=54, blocking=true) at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_parse.cc:1903
      #33 0x000060729041c7d3 in do_command (thd=0x6cb238000d60, blocking=true)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_parse.cc:1437
      #34 0x0000607290628099 in do_handle_one_connection (connect=0x6072bf7632a0, put_in_cache=true)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_connect.cc:1514
      #35 0x0000607290627e3e in handle_one_connection (arg=0x6072bf6eb7a0)at /test/mtest/MDEV-38740/pr5263_dbg/sql/sql_connect.cc:1426
      #36 0x000074b351a9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #37 0x000074b351b29ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              danblack Daniel Black
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.5h
                  0.5h

                  Git Integration

                    Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.