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

Assertion `typeid(*copy) == typeid(*this)' failed in Item::get_copy on SELECT

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.6, 10.11, 11.4, 11.8, 12.1(EOL), 12.2
    • 10.6.25
    • Optimizer, Server
    • None
    • Can result in hang or crash

    Description

      Split from MDEV-36888

      CREATE TABLE t (c INT);
      SELECT * FROM t GROUP BY c HAVING c=c OR TIMESTAMPADD(SECOND, c, AVG(c) IS NULL IS NULL) AND c LIKE (SELECT 1);
      

      Leads to:

      CS 12.1.2 033471a367b4c60b7262e64f43f46b02e95b9d74 (Debug, Clang 18.1.3-1) Build 08/08/2025

      mariadbd: /test/12.1_dbg/sql/item.h:1911: Item *Item::get_copy(THD *) const: Assertion `typeid(*copy) == typeid(*this)' failed.
      

      CS 12.1.2 033471a367b4c60b7262e64f43f46b02e95b9d74 (Debug, Clang 18.1.3-1) Build 08/08/2025

      Core was generated by `/test/MD080825-mariadb-12.1.2-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      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 2525620)]
      (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  0x0000757662a4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000757662a288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000757662a2881b in __assert_fail_base (fmt=0x757662bd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5cd16f6805ee "typeid(*copy) == typeid(*this)", file=file@entry=0x5cd16f663c00 "/test/12.1_dbg/sql/item.h", line=line@entry=1911, function=function@entry=0x5cd16f601459 "Item *Item::get_copy(THD *) const")at ./assert/assert.c:94
      #6  0x0000757662a3b507 in __assert_fail (assertion=0x5cd16f6805ee "typeid(*copy) == typeid(*this)", file=0x5cd16f663c00 "/test/12.1_dbg/sql/item.h", line=1911, function=0x5cd16f601459 "Item *Item::get_copy(THD *) const")at ./assert/assert.c:103
      #7  0x00005cd16fe4f424 in Item::get_copy (this=0x75753401ec50, thd=0x757534000d58) at /test/12.1_dbg/sql/item.h:1911
      #8  0x00005cd16fefa751 in Item_ref::do_build_clone (this=0x75753401ec50, thd=0x757534000d58) at /test/12.1_dbg/sql/item.cc:3227
      #9  0x00005cd16fee16b5 in Item::build_clone (this=0x75753401ec50, thd=0x757534000d58) at /test/12.1_dbg/sql/item.h:1925
      #10 0x00005cd16fef8f61 in Item_func_or_sum::do_build_clone (this=0x75753401b7c0, thd=0x757534000d58) at /test/12.1_dbg/sql/item.cc:2885
      #11 0x00005cd16fee16b5 in Item::build_clone (this=0x75753401b7c0, thd=0x757534000d58) at /test/12.1_dbg/sql/item.h:1925
      #12 0x00005cd16fef8f61 in Item_func_or_sum::do_build_clone (this=0x75753401b880, thd=0x757534000d58) at /test/12.1_dbg/sql/item.cc:2885
      #13 0x00005cd16fee16b5 in Item::build_clone (this=0x75753401b880, thd=0x757534000d58) at /test/12.1_dbg/sql/item.h:1925
      #14 0x00005cd16fef8f61 in Item_func_or_sum::do_build_clone (this=0x75753401b940, thd=0x757534000d58) at /test/12.1_dbg/sql/item.cc:2885
      #15 0x00005cd16fee16b5 in Item::build_clone (this=0x75753401b940, thd=0x757534000d58) at /test/12.1_dbg/sql/item.h:1925
      #16 0x00005cd16ff0aff2 in Item::build_pushable_cond (this=0x75753401b940, thd=0x757534000d58, checker=NULL, arg=0x0)at /test/12.1_dbg/sql/item.cc:8181
      #17 0x00005cd16ff0ac86 in Item::build_pushable_cond (this=0x75753401ccc8, thd=0x757534000d58, checker=NULL, arg=0x0)at /test/12.1_dbg/sql/item.cc:8130
      #18 0x00005cd16ff0ac86 in Item::build_pushable_cond (this=0x75753401cdf0, thd=0x757534000d58, checker=NULL, arg=0x0)at /test/12.1_dbg/sql/item.cc:8130
      #19 0x00005cd1702fa6c6 in st_select_lex::build_pushable_cond_for_having_pushdown (this=0x757534019fb8, thd=0x757534000d58, cond=0x75753401cdf0)at /test/12.1_dbg/sql/sql_lex.cc:12098
      #20 0x00005cd1702fb203 in st_select_lex::pushdown_from_having_into_where (this=0x757534019fb8, thd=0x757534000d58, having=0x75753401cdf0)at /test/12.1_dbg/sql/sql_lex.cc:12384
      #21 0x00005cd17039f994 in JOIN::optimize_inner (this=0x75753401d8d0)at /test/12.1_dbg/sql/sql_select.cc:2495
      #22 0x00005cd17039bbf8 in JOIN::optimize (this=0x75753401d8d0)at /test/12.1_dbg/sql/sql_select.cc:2023
      #23 0x00005cd170393849 in mysql_select (thd=0x757534000d58, tables=0x75753401a608, fields=@0x75753401a270: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x75753401a5b8, last = 0x75753401a5b8, elements = 1}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x75753401ae80, having=0x75753401cdf0, proc_param=0x0, select_options=2164525824, result=0x75753401d8a8, unit=0x757534005158, select_lex=0x757534019fb8)at /test/12.1_dbg/sql/sql_select.cc:5388
      #24 0x00005cd170393385 in handle_select (thd=0x757534000d58, lex=0x757534005078, result=0x75753401d8a8, setup_tables_done_option=0)at /test/12.1_dbg/sql/sql_select.cc:634
      #25 0x00005cd1703374d1 in execute_sqlcom_select (thd=0x757534000d58, all_tables=0x75753401a608) at /test/12.1_dbg/sql/sql_parse.cc:6167
      #26 0x00005cd17032c25e in mysql_execute_command (thd=0x757534000d58, is_called_from_prepared_stmt=false) at /test/12.1_dbg/sql/sql_parse.cc:3950
      #27 0x00005cd170324524 in mysql_parse (thd=0x757534000d58, rawbuf=0x757534019e80 "SELECT * FROM t GROUP BY c HAVING c=c OR TIMESTAMPADD(SECOND, c, AVG(c) IS NULL IS NULL) AND c LIKE (SELECT 1)", length=110, parser_state=0x75765bf67a10) at /test/12.1_dbg/sql/sql_parse.cc:7883
      #28 0x00005cd1703218f8 in dispatch_command (command=COM_QUERY, thd=0x757534000d58, packet=0x75753400b1f9 "SELECT * FROM t GROUP BY c HAVING c=c OR TIMESTAMPADD(SECOND, c, AVG(c) IS NULL IS NULL) AND c LIKE (SELECT 1)", packet_length=110, blocking=true) at /test/12.1_dbg/sql/sql_parse.cc:1878
      #29 0x00005cd1703250d3 in do_command (thd=0x757534000d58, blocking=true)at /test/12.1_dbg/sql/sql_parse.cc:1417
      #30 0x00005cd170544139 in do_handle_one_connection (connect=0x5cd173b3dbd8, put_in_cache=true) at /test/12.1_dbg/sql/sql_connect.cc:1414
      #31 0x00005cd170543ede in handle_one_connection (arg=0x5cd173a695b8)at /test/12.1_dbg/sql/sql_connect.cc:1326
      #32 0x0000757662a9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #33 0x0000757662b29c3c 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  080825  13f337ce1f295f4aac75db681e00c71f2bf8acaf  typeid(*copy) == typeid(*this)|SIGABRT|Item::get_copy|Item_ref::do_build_clone|Item::build_clone|Item_func_or_sum::do_build_clone
      CS  10.6   opt  080825  13f337ce1f295f4aac75db681e00c71f2bf8acaf  No bug found                  
      CS  10.11  dbg  080825  c45a34b2fb10e4e8f768e7e5fe846e9592eb6ea8  typeid(*copy) == typeid(*this)|SIGABRT|Item::get_copy|Item_ref::do_build_clone|Item::build_clone|Item_func_or_sum::do_build_clone
      CS  10.11  opt  080825  c45a34b2fb10e4e8f768e7e5fe846e9592eb6ea8  No bug found                  
      CS  11.4   dbg  080825  03b31c0bd99390c1984f19a19f22dd6e77b7692e  typeid(*copy) == typeid(*this)|SIGABRT|Item::get_copy|Item_ref::do_build_clone|Item::build_clone|Item_func_or_sum::do_build_clone
      CS  11.4   opt  080825  03b31c0bd99390c1984f19a19f22dd6e77b7692e  No bug found                  
      CS  11.8   dbg  080825  1a446ccc48528e88a3cd6cd1d1ec9e7492d342ca  typeid(*copy) == typeid(*this)|SIGABRT|Item::get_copy|Item_ref::do_build_clone|Item::build_clone|Item_func_or_sum::do_build_clone
      CS  11.8   opt  080825  1a446ccc48528e88a3cd6cd1d1ec9e7492d342ca  No bug found                  
      CS  12.1   dbg  080825  033471a367b4c60b7262e64f43f46b02e95b9d74  typeid(*copy) == typeid(*this)|SIGABRT|Item::get_copy|Item_ref::do_build_clone|Item::build_clone|Item_func_or_sum::do_build_clone
      CS  12.1   opt  080825  033471a367b4c60b7262e64f43f46b02e95b9d74  No bug found                  
      CS  12.2   dbg  080825  e02f4d7e311e214ea62ff2e59599849e229f4165  typeid(*copy) == typeid(*this)|SIGABRT|Item::get_copy|Item_ref::do_build_clone|Item::build_clone|Item_func_or_sum::do_build_clone
      CS  12.2   opt  080825  e02f4d7e311e214ea62ff2e59599849e229f4165  No bug found                  
      ES  10.5   dbg  080825  70586522eacf09d04d49962072e14325a75d8155  No bug found                  
      ES  10.5   opt  080825  70586522eacf09d04d49962072e14325a75d8155  No bug found                  
      ES  10.6   dbg  080825  9b794f34b48fb7eee490b6da44edc0f33a947447  typeid(*copy) == typeid(*this)|SIGABRT|Item::get_copy|Item_ref::do_build_clone|Item::build_clone|Item_func_or_sum::do_build_clone
      ES  10.6   opt  080825  9b794f34b48fb7eee490b6da44edc0f33a947447  No bug found                  
      ES  11.4   dbg  080825  a1c03ccd54b582e75506687ee19b273ca897f261  typeid(*copy) == typeid(*this)|SIGABRT|Item::get_copy|Item_ref::do_build_clone|Item::build_clone|Item_func_or_sum::do_build_clone
      ES  11.4   opt  080825  a1c03ccd54b582e75506687ee19b273ca897f261  No bug found                  
      ES  11.8   dbg  080825  4cdf75ab6ba37d4e7e208690785e880ed3176f2f  typeid(*copy) == typeid(*this)|SIGABRT|Item::get_copy|Item_ref::do_build_clone|Item::build_clone|Item_func_or_sum::do_build_clone
      ES  11.8   opt  080825  4cdf75ab6ba37d4e7e208690785e880ed3176f2f  No bug found                  
      MS  5.5    dbg  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.5    opt  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.6    dbg  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.6    opt  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.7    dbg  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  5.7    opt  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  8.0    dbg  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  8.0    opt  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  9.1    dbg  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      MS  9.1    opt  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      

      Attachments

        Issue Links

          Activity

            People

              raghunandan.bhat Raghunandan Bhat
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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