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

Assertion `m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length' failed in bool Create_tmp_table::finalize(THD *, TABLE *, TMP_TABLE_PARAM *, bool, bool)

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      --source include/have_innodb.inc
       
      SET sql_mode=ORACLE;
      CREATE TABLE t (c DATE,v2 DATE DEFAULT (c)) ENGINE=INNODB;
      SELECT DISTINCT DEFAULT (v2) FROM t;
       
      #cleanup 
      DROP TABLE t;
      

      Leads to:

      CS 12.3.2 620733d35db2108dc34ad74f35f6b4cb2722b594 (Debug, Clang 18.1.3-11) Build 06/04/2026

      mariadbd: /test/12.3_dbg/sql/sql_select.cc:22773: bool Create_tmp_table::finalize(THD *, TABLE *, TMP_TABLE_PARAM *, bool, bool): Assertion `m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length' failed.
      

      CS 12.3.2 620733d35db2108dc34ad74f35f6b4cb2722b594 (Debug, Clang 18.1.3-11) Build 06/04/2026

      Core was generated by `/test/MD060426-mariadb-12.3.2-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
      Download failed: Invalid argument.  Continuing without source file ./nptl/./nptl/pthread_kill.c.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 1329082)]
      (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  0x00007e81ffc4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007e81ffc288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007e81ffc2881b in __assert_fail_base (fmt=0x7e81ffdd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5738bc77a467 "m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length", file=file@entry=0x5738bc777cdf "/test/12.3_dbg/sql/sql_select.cc", line=line@entry=22773, function=function@entry=0x5738bc77a3c5 "bool Create_tmp_table::finalize(THD *, TABLE *, TMP_TABLE_PARAM *, bool, bool)") at ./assert/assert.c:96
      #6  0x00007e81ffc3b517 in __assert_fail (assertion=0x5738bc77a467 "m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length", file=0x5738bc777cdf "/test/12.3_dbg/sql/sql_select.cc", line=22773, function=0x5738bc77a3c5 "bool Create_tmp_table::finalize(THD *, TABLE *, TMP_TABLE_PARAM *, bool, bool)") at ./assert/assert.c:105
      #7  0x00005738bb701d22 in Create_tmp_table::finalize (this=0x7e7e201e3f88, thd=0x7e631c000d58, table=0x7e631c078f10, param=0x7e631c01e528, do_not_open=true, keep_row_order=false)at /test/12.3_dbg/sql/sql_select.cc:22772
      #8  0x00005738bb6d9f6f in create_tmp_table (thd=0x7e631c000d58, param=0x7e631c01e528, fields=@0x7e631c01be88: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7e631c01a908, last = 0x7e631c01a908, elements = 1}, <No data fields>}, group=0x7e631c01e4d0, distinct=false, save_sum_fields=false, select_options=2164525825, rows_limit=18446744073709551615, table_alias=0x5738bd0410f0 <empty_clex_str>, do_not_open=true, keep_row_order=false) at /test/12.3_dbg/sql/sql_select.cc:23029
      #9  0x00005738bb6db3c0 in JOIN::create_postjoin_aggr_table (this=0x7e631c01bae0, tab=0x7e631c01d790, table_fields=0x7e631c01be88, table_group=0x7e631c01e4d0, save_sum_fields=false, distinct=false, keep_row_order=false) at /test/12.3_dbg/sql/sql_select.cc:4408
      #10 0x00005738bb6d7a2a in JOIN::make_aggr_tables_info (this=0x7e631c01bae0)at /test/12.3_dbg/sql/sql_select.cc:3968
      #11 0x00005738bb6c6e4d in JOIN::optimize_stage2 (this=0x7e631c01bae0)at /test/12.3_dbg/sql/sql_select.cc:3576
      #12 0x00005738bb6c47e6 in JOIN::optimize_inner (this=0x7e631c01bae0)at /test/12.3_dbg/sql/sql_select.cc:2789
      #13 0x00005738bb6c1f8d in JOIN::optimize (this=0x7e631c01bae0)at /test/12.3_dbg/sql/sql_select.cc:2016
      #14 0x00005738bb6b9b78 in mysql_select (thd=0x7e631c000d58, tables=0x7e631c01a980, fields=@0x7e631c01a480: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7e631c01a908, last = 0x7e631c01a908, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525825, result=0x7e631c01bab8, unit=0x7e631c005280, select_lex=0x7e631c01a1c8) at /test/12.3_dbg/sql/sql_select.cc:5425
      #15 0x00005738bb6b9705 in handle_select (thd=0x7e631c000d58, lex=0x7e631c0051a0, result=0x7e631c01bab8, setup_tables_done_option=0)at /test/12.3_dbg/sql/sql_select.cc:636
      #16 0x00005738bb65c511 in execute_sqlcom_select (thd=0x7e631c000d58, all_tables=0x7e631c01a980) at /test/12.3_dbg/sql/sql_parse.cc:6212
      #17 0x00005738bb65128c in mysql_execute_command (thd=0x7e631c000d58, is_called_from_prepared_stmt=false) at /test/12.3_dbg/sql/sql_parse.cc:3987
      #18 0x00005738bb649484 in mysql_parse (thd=0x7e631c000d58, rawbuf=0x7e631c01a120 "SELECT DISTINCT DEFAULT (v2) FROM t", length=35, parser_state=0x7e7e201e69f0) at /test/12.3_dbg/sql/sql_parse.cc:7940
      #19 0x00005738bb64682d in dispatch_command (command=COM_QUERY, thd=0x7e631c000d58, packet=0x7e631c00b4c9 "SELECT DISTINCT DEFAULT (v2) FROM t", packet_length=35, blocking=true) at /test/12.3_dbg/sql/sql_parse.cc:1896
      #20 0x00005738bb64a033 in do_command (thd=0x7e631c000d58, blocking=true)at /test/12.3_dbg/sql/sql_parse.cc:1432
      #21 0x00005738bb844829 in do_handle_one_connection (connect=0x5738fc8f3898, put_in_cache=true) at /test/12.3_dbg/sql/sql_connect.cc:1503
      #22 0x00005738bb8445ce in handle_one_connection (arg=0x5738fc8d7458)at /test/12.3_dbg/sql/sql_connect.cc:1415
      #23 0x00007e81ffc9caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #24 0x00007e81ffd29c6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed
      CS  10.6   dbg  060426  6ffb219883725fabda83d77d68df88e16b3760ad  m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length|SIGABRT|Create_tmp_table::finalize|create_tmp_table|JOIN::create_postjoin_aggr_table|JOIN::make_aggr_tables_info
      CS  10.6   opt  060426  6ffb219883725fabda83d77d68df88e16b3760ad  No bug found
      CS  10.11  dbg  060426  fb9d6e444c370bcce5f00047ad335953f174897a  m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length|SIGABRT|Create_tmp_table::finalize|create_tmp_table|JOIN::create_postjoin_aggr_table|JOIN::make_aggr_tables_info
      CS  10.11  opt  060426  fb9d6e444c370bcce5f00047ad335953f174897a  No bug found
      CS  11.4   dbg  060426  3b206b9cc6ac3e8a975c7e1c0b5fd72024544fe7  m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length|SIGABRT|Create_tmp_table::finalize|create_tmp_table|JOIN::create_postjoin_aggr_table|JOIN::make_aggr_tables_info
      CS  11.4   opt  060426  3b206b9cc6ac3e8a975c7e1c0b5fd72024544fe7  No bug found
      CS  11.8   dbg  060426  e47db94aea7f0d6e0177e948486fc8860331f05f  m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length|SIGABRT|Create_tmp_table::finalize|create_tmp_table|JOIN::create_postjoin_aggr_table|JOIN::make_aggr_tables_info
      CS  11.8   opt  060426  e47db94aea7f0d6e0177e948486fc8860331f05f  No bug found
      CS  12.2   dbg  060426  d26a6f44c1f2119377e79a9540886c6d8c01472f  m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length|SIGABRT|Create_tmp_table::finalize|create_tmp_table|JOIN::create_postjoin_aggr_table|JOIN::make_aggr_tables_info
      CS  12.2   opt  060426  d26a6f44c1f2119377e79a9540886c6d8c01472f  No bug found
      CS  12.3   dbg  060426  620733d35db2108dc34ad74f35f6b4cb2722b594  m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length|SIGABRT|Create_tmp_table::finalize|create_tmp_table|JOIN::create_postjoin_aggr_table|JOIN::make_aggr_tables_info
      CS  12.3   opt  060426  620733d35db2108dc34ad74f35f6b4cb2722b594  No bug found
      CS  13.0   dbg  070426  90f8178f33f6ecd33767a79b0f5b9b4c5a1367e5  m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length|SIGABRT|Create_tmp_table::finalize|create_tmp_table|JOIN::create_postjoin_aggr_table|JOIN::make_aggr_tables_info
      CS  13.0   opt  070426  90f8178f33f6ecd33767a79b0f5b9b4c5a1367e5  No bug found
      ES  10.5   dbg  040825  70586522eacf09d04d49962072e14325a75d8155  m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length|SIGABRT|Create_tmp_table::finalize|create_tmp_table|JOIN::create_postjoin_aggr_table|JOIN::make_aggr_tables_info
      ES  10.5   opt  040825  70586522eacf09d04d49962072e14325a75d8155  No bug found
      ES  10.6   dbg  040825  9b794f34b48fb7eee490b6da44edc0f33a947447  m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length|SIGABRT|Create_tmp_table::finalize|create_tmp_table|JOIN::create_postjoin_aggr_table|JOIN::make_aggr_tables_info
      ES  10.6   opt  040825  9b794f34b48fb7eee490b6da44edc0f33a947447  No bug found
      ES  11.4   dbg  040825  a1c03ccd54b582e75506687ee19b273ca897f261  m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length|SIGABRT|Create_tmp_table::finalize|create_tmp_table|JOIN::create_postjoin_aggr_table|JOIN::make_aggr_tables_info
      ES  11.4   opt  040825  a1c03ccd54b582e75506687ee19b273ca897f261  No bug found
      ES  11.8   dbg  151025  780565c207e9ce0ebf7d8e3d59f223801447b619  m_using_unique_constraint || m_group_buff <= param->group_buff + param->group_length|SIGABRT|Create_tmp_table::finalize|create_tmp_table|JOIN::create_postjoin_aggr_table|JOIN::make_aggr_tables_info
      ES  11.8   opt  151025  780565c207e9ce0ebf7d8e3d59f223801447b619  No bug found
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            ramesh Ramesh Sivaraman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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