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

Assertion `prm.count > 0' failed in Item_exists_subselect::exists2in_processor upon UPDATE

    XMLWordPrintable

Details

    Description

      CREATE TABLE t (c INT);
      UPDATE t SET c=1 IN (SELECT c FROM t AS t1 NATURAL JOIN t WHERE EXISTS (SELECT 1 FROM t WHERE c IN (SELECT c=1)));
      

      Leads to:

      CS 11.4.6 4a701e8ce4a178faf955641caf59fc13fcc718e9 (Debug) Build 12/04/2025

      mariadbd: /test/11.4_dbg/sql/item_subselect.cc:3202: virtual bool Item_exists_subselect::exists2in_processor(void *): Assertion `prm.count > 0' failed.
      

      CS 11.4.6 4a701e8ce4a178faf955641caf59fc13fcc718e9 (Debug) Build 12/04/2025

      Core was generated by `/test/MD120425-mariadb-11.4.6-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 170818)]
      (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  0x000079c009a4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000079c009a288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000079c009a2881b in __assert_fail_base (fmt=0x79c009bd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x57c8d4e00c60 "prm.count > 0", file=file@entry=0x57c8d4dfff42 "/test/11.4_dbg/sql/item_subselect.cc", line=line@entry=3202, function=function@entry=0x57c8d4e00c0c "virtual bool Item_exists_subselect::exists2in_processor(void *)") at ./assert/assert.c:94
      #6  0x000079c009a3b507 in __assert_fail (assertion=0x57c8d4e00c60 "prm.count > 0", file=0x57c8d4dfff42 "/test/11.4_dbg/sql/item_subselect.cc", line=3202, function=0x57c8d4e00c0c "virtual bool Item_exists_subselect::exists2in_processor(void *)") at ./assert/assert.c:103
      #7  0x000057c8d42c86e2 in Item_exists_subselect::exists2in_processor (this=0x79beb401eb60, opt_arg=0x79beb4000d58)at /test/11.4_dbg/sql/item_subselect.cc:3202
      #8  0x000057c8d42bd4cb in Item_subselect::walk (this=0x79beb401eb60, processor=&virtual table offset 1048, walk_subquery=false, argument=0x79beb4000d58) at /test/11.4_dbg/sql/item_subselect.cc:782
      #9  0x000057c8d41e14a4 in Item_in_optimizer::walk (this=0x79beb407e5c0, processor=&virtual table offset 1048, walk_subquery=false, arg=0x79beb4000d58) at /test/11.4_dbg/sql/item_cmpfunc.cc:1537
      #10 0x000057c8d3dee647 in JOIN::optimize_inner (this=0x79beb40203a0)at /test/11.4_dbg/sql/sql_select.cc:2238
      #11 0x000057c8d3debb28 in JOIN::optimize (this=0x79beb40203a0)at /test/11.4_dbg/sql/sql_select.cc:2003
      #12 0x000057c8d3d42eae in st_select_lex::optimize_unflattened_subqueries (this=0x79beb4005838, const_only=true) at /test/11.4_dbg/sql/sql_lex.cc:5006
      #13 0x000057c8d3fcfc67 in JOIN::optimize_constant_subqueries (this=0x79beb401fa18) at /test/11.4_dbg/sql/opt_subselect.cc:5908
      #14 0x000057c8d3deecbb in JOIN::optimize_inner (this=0x79beb401fa18)at /test/11.4_dbg/sql/sql_select.cc:2348
      #15 0x000057c8d3debb28 in JOIN::optimize (this=0x79beb401fa18)at /test/11.4_dbg/sql/sql_select.cc:2003
      #16 0x000057c8d3e3bea7 in Sql_cmd_dml::execute_inner (this=0x79beb401f828, thd=0x79beb4000d58) at /test/11.4_dbg/sql/sql_select.cc:34489
      #17 0x000057c8d3ee9795 in Sql_cmd_update::execute_inner (this=0x79beb401f828, thd=0x79beb4000d58) at /test/11.4_dbg/sql/sql_update.cc:3123
      #18 0x000057c8d3e3bbc6 in Sql_cmd_dml::execute (this=0x79beb401f828, thd=0x79beb4000d58) at /test/11.4_dbg/sql/sql_select.cc:34438
      #19 0x000057c8d3d8244d in mysql_execute_command (thd=0x79beb4000d58, is_called_from_prepared_stmt=false) at /test/11.4_dbg/sql/sql_parse.cc:4424
      #20 0x000057c8d3d78744 in mysql_parse (thd=0x79beb4000d58, rawbuf=0x79beb4019ac0 "UPDATE t SET c=1 IN (SELECT c FROM t AS t1 NATURAL JOIN t WHERE EXISTS (SELECT 1 FROM t WHERE c IN (SELECT c=1)))", length=113, parser_state=0x79c004181a30) at /test/11.4_dbg/sql/sql_parse.cc:7907
      #21 0x000057c8d3d75bf4 in dispatch_command (command=COM_QUERY, thd=0x79beb4000d58, packet=0x79beb400afd9 "UPDATE t SET c=1 IN (SELECT c FROM t AS t1 NATURAL JOIN t WHERE EXISTS (SELECT 1 FROM t WHERE c IN (SELECT c=1)))", packet_length=113, blocking=true) at /test/11.4_dbg/sql/sql_parse.cc:1904
      #22 0x000057c8d3d792f3 in do_command (thd=0x79beb4000d58, blocking=true)at /test/11.4_dbg/sql/sql_parse.cc:1417
      #23 0x000057c8d3f5b619 in do_handle_one_connection (connect=0x57c8d72283b8, put_in_cache=true) at /test/11.4_dbg/sql/sql_connect.cc:1408
      #24 0x000057c8d3f5b3b2 in handle_one_connection (arg=0x57c8d728be68)at /test/11.4_dbg/sql/sql_connect.cc:1320
      #25 0x000079c009a9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #26 0x000079c009b29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.5   dbg  120425  e6ea5d568c0fb972a391a8c64716846ddb7c57ef  prm.count > 0|SIGABRT|Item_exists_subselect::exists2in_processor|Item_subselect::walk|Item_in_optimizer::walk|JOIN::optimize_inner
      CS  10.5   opt  120425  e6ea5d568c0fb972a391a8c64716846ddb7c57ef  No bug found                  
      CS  10.6   dbg  120425  690b2cf776faa2e1a6832077cec2246c86cd00bf  prm.count > 0|SIGABRT|Item_exists_subselect::exists2in_processor|Item_subselect::walk|Item_in_optimizer::walk|JOIN::optimize_inner
      CS  10.6   opt  120425  690b2cf776faa2e1a6832077cec2246c86cd00bf  No bug found                  
      CS  10.11  dbg  120425  acd071f599f416ddb4821dec485c4d912844213f  prm.count > 0|SIGABRT|Item_exists_subselect::exists2in_processor|Item_subselect::walk|Item_in_optimizer::walk|JOIN::optimize_inner
      CS  10.11  opt  120425  acd071f599f416ddb4821dec485c4d912844213f  No bug found                  
      CS  11.4   dbg  120425  4a701e8ce4a178faf955641caf59fc13fcc718e9  prm.count > 0|SIGABRT|Item_exists_subselect::exists2in_processor|Item_subselect::walk|Item_in_optimizer::walk|JOIN::optimize_inner
      CS  11.4   opt  120425  4a701e8ce4a178faf955641caf59fc13fcc718e9  No bug found                  
      CS  11.8   dbg  030525  865b05bf4acf10e0d4b3359019ed7b2efe0be81d  prm.count > 0|SIGABRT|Item_exists_subselect::exists2in_processor|Item_subselect::walk|Item_in_optimizer::walk|JOIN::optimize_inner
      CS  11.8   dbg  120425  db5bb6f3339be5a49c0f397eb80a0f259f73f447  prm.count > 0|SIGABRT|Item_exists_subselect::exists2in_processor|Item_subselect::walk|Item_in_optimizer::walk|JOIN::optimize_inner
      CS  11.8   opt  120425  db5bb6f3339be5a49c0f397eb80a0f259f73f447  No bug found                  
      CS  12.0   dbg  120425  22efc2c784e1b7199fb5804e6330168277ea7dce  prm.count > 0|SIGABRT|Item_exists_subselect::exists2in_processor|Item_subselect::walk|Item_in_optimizer::walk|JOIN::optimize_inner
      CS  12.0   opt  120425  22efc2c784e1b7199fb5804e6330168277ea7dce  No bug found                  
      ES  10.5   dbg  210425  0d368ec0042a81d9549fc939fb742f82350b20ab  prm.count > 0|SIGABRT|Item_exists_subselect::exists2in_processor|Item_subselect::walk|Item_in_optimizer::walk|JOIN::optimize_inner
      ES  10.5   opt  210425  0d368ec0042a81d9549fc939fb742f82350b20ab  No bug found                  
      ES  10.6   dbg  210425  74602d1b054ba6c9ee20af79d6e7807440a7a98e  prm.count > 0|SIGABRT|Item_exists_subselect::exists2in_processor|Item_subselect::walk|Item_in_optimizer::walk|JOIN::optimize_inner
      ES  10.6   opt  210425  74602d1b054ba6c9ee20af79d6e7807440a7a98e  No bug found                  
      ES  11.4   dbg  210425  9cd12544ebfd0d52d2158af66b5aced58121cf1f  prm.count > 0|SIGABRT|Item_exists_subselect::exists2in_processor|Item_subselect::walk|Item_in_optimizer::walk|JOIN::optimize_inner
      ES  11.4   opt  210425  9cd12544ebfd0d52d2158af66b5aced58121cf1f  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  060224  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  5.7    opt  060224  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                  
      

      Reproducible on at least InnoDB and MyISAM.

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              Roel Roel Van de Paar
              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.