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

Assertion `rec->field->head()->charset == nullptr' failed in virtual bool Type_handler_row::Column_definition_prepare_stage1(THD *, MEM_ROOT *, Column_definition *, column_definition_type_t, const Column_derived_attributes *) const

    XMLWordPrintable

Details

    • Not for Release Notes
    • Q3/2026 Server Maintenance

    Description

      MTR Test case, the crash is happening only on debug build.

      SET sql_mode=ORACLE;
       
      DELIMITER $$;
      CREATE PACKAGE pk_crash AS TYPE r IS RECORD (b BLOB); FUNCTION f RETURN r; END;
      $$
      DELIMITER ;$$
      

      Leads to

      MDEV-39587 CS 13.1.0 667959df058b5179e737f103d78abef77f1bca5e (Debug, Clang 18.1.3-11) Build 22/06/2026

      mariadbd: /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_type_row.cc:255: virtual bool Type_handler_row::Column_definition_prepare_stage1(THD *, MEM_ROOT *, Column_definition *, column_definition_type_t, const Column_derived_attributes *) const: Assertion `rec->field->head()->charset == nullptr' failed.
      

      MDEV-39587 CS 13.1.0 667959df058b5179e737f103d78abef77f1bca5e (Debug, Clang 18.1.3-11) Build 22/06/2026

      Core was generated by `/test/mtest/MDEV-39587/MD220626-mariadb-13.1.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 2762015)]
      (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  0x00007db16504527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007db1650288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007db16502881b in __assert_fail_base (fmt=0x7db1651d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x636a7c1ab678 "rec->field->head()->charset == nullptr", file=file@entry=0x636a7c1ab438 "/test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_type_row.cc", line=line@entry=255, function=function@entry=0x636a7c1ab5b8 "virtual bool Type_handler_row::Column_definition_prepare_stage1(THD *, MEM_ROOT *, Column_definition *, column_definition_type_t, const Column_derived_attributes *) const")at ./assert/assert.c:96
      #6  0x00007db16503b517 in __assert_fail (assertion=0x636a7c1ab678 "rec->field->head()->charset == nullptr", file=0x636a7c1ab438 "/test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_type_row.cc", line=255, function=0x636a7c1ab5b8 "virtual bool Type_handler_row::Column_definition_prepare_stage1(THD *, MEM_ROOT *, Column_definition *, column_definition_type_t, const Column_derived_attributes *) const") at ./assert/assert.c:105
      #7  0x0000636a7b357d87 in Type_handler_row::Column_definition_prepare_stage1 (this=0x636a7ce62c88 <type_handler_row_internal>, thd=0x75b02c000d60, mem_root=0x75b02c028698, def=0x75b02c028700, type=COLUMN_DEFINITION_ROUTINE_LOCAL, derived_attr=0x7db13ca3a230)at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_type_row.cc:255
      #8  0x0000636a7b10f4a3 in Column_definition::prepare_stage1 (this=0x75b02c028700, thd=0x75b02c000d60, mem_root=0x75b02c028698, deftype=COLUMN_DEFINITION_ROUTINE_LOCAL, derived_attr=0x7db13ca3a230)at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_table.cc:2650
      #9  0x0000636a7b10f7da in Column_definition::sp_prepare_create_field (this=0x75b02c028700, thd=0x75b02c000d60, mem_root=0x75b02c028698)at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_table.cc:4285
      #10 0x0000636a7aecd6d9 in sp_head::fill_field_definition (this=0x75b02c028650, thd=0x75b02c000d60, field_def=0x75b02c028700)at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sp_head.h:807
      #11 0x0000636a7afa4479 in LEX::sf_return_fill_definition (this=0x75b02c026640, def=@0x7db13ca41ad8: {<Lex_length_and_dec_st> = {m_length = 0, m_dec = 0 '\000', m_collation_type = 0 '\000', m_has_explicit_length = false, m_has_explicit_dec = false, m_length_overflowed = false, m_dec_overflowed = false, m_foreign_module_type = false}, m_handler = 0x636a7ce62c88 <type_handler_row_internal>, m_ci = 0x0})at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_lex.cc:6882
      #12 0x0000636a7b3ee7a1 in ORAparse (thd=0x75b02c000d60)at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_yacc.yy:19880
      #13 0x0000636a7affdc1a in parse_sql (thd=0x75b02c000d60, parser_state=0x7db13ca42ab0, creation_ctx=0x0, do_pfs_digest=true)at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_parse.cc:10372
      #14 0x0000636a7afe6013 in mysql_parse (thd=0x75b02c000d60, rawbuf=0x75b02c01a3e0 "CREATE PACKAGE pk_crash AS TYPE r IS RECORD (b BLOB); FUNCTION f RETURN r; END", length=78, parser_state=0x7db13ca42ab0)at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_parse.cc:7897
      #15 0x0000636a7afe34cd in dispatch_command (command=COM_QUERY, thd=0x75b02c000d60, packet=0x75b02c00b611 "CREATE PACKAGE pk_crash AS TYPE r IS RECORD (b BLOB); FUNCTION f RETURN r; END;", packet_length=79, blocking=true)at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_parse.cc:1903
      #16 0x0000636a7afe6d33 in do_command (thd=0x75b02c000d60, blocking=true)at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_parse.cc:1437
      #17 0x0000636a7b1e52e9 in do_handle_one_connection (connect=0x636a8341a5f0, put_in_cache=true)at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_connect.cc:1503
      #18 0x0000636a7b1e508e in handle_one_connection (arg=0x636a833a2830)at /test/mtest/MDEV-39587/bb-13.1-bar-MDEV-39587_dbg/sql/sql_connect.cc:1415
      #19 0x00007db16509caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #20 0x00007db165129c6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

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

                  Git Integration

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