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

Assertion `select_lex->leaf_tables.elements != 0' failed in mysql_insert_select_prepare on 2nd execution of SP

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.2, 10.3, 10.4, 10.5, 10.6
    • 10.4, 10.5, 10.6
    • Stored routines
    • None

    Description

      DELIMITER __
      CREATE PROCEDURE p() BEGIN EXPLAIN INSERT INTO t SELECT 1;END__
      DELIMITER ;
      CREATE TABLE t (c int);
      CALL p;
      CALL p;
      

      Leads to:

      10.6.0 9118fd360a3da0bba521caf2a35c424968235ac4 (Debug)

      mysqld: /test/10.6_dbg/sql/sql_insert.cc:3748: int mysql_insert_select_prepare(THD*, select_result*): Assertion `select_lex->leaf_tables.elements != 0' failed.
      

      10.6.0 9118fd360a3da0bba521caf2a35c424968235ac4 (Debug)

      Core was generated by `/test/MD010121-mariadb-10.6.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      [Current thread is 1 (Thread 0x14d7e05cc700 (LWP 325013))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      #1  0x00005585ff0600d7 in my_write_core (sig=sig@entry=6) at /test/10.6_dbg/mysys/stacktrace.c:424
      #2  0x00005585fe7f4ab1 in handle_fatal_signal (sig=6) at /test/10.6_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #5  0x000014d7e1a30859 in __GI_abort () at abort.c:79
      #6  0x000014d7e1a30729 in __assert_fail_base (fmt=0x14d7e1bc6588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5585ff1c25f8 "select_lex->leaf_tables.elements != 0", file=0x5585ff1c1ce0 "/test/10.6_dbg/sql/sql_insert.cc", line=3748, function=<optimized out>) at assert.c:92
      #7  0x000014d7e1a41f36 in __GI___assert_fail (assertion=assertion@entry=0x5585ff1c25f8 "select_lex->leaf_tables.elements != 0", file=file@entry=0x5585ff1c1ce0 "/test/10.6_dbg/sql/sql_insert.cc", line=line@entry=3748, function=function@entry=0x5585ff1c2620 "int mysql_insert_select_prepare(THD*, select_result*)") at assert.c:101
      #8  0x00005585fe4e39e2 in mysql_insert_select_prepare (thd=thd@entry=0x14d790000db8, sel_res=sel_res@entry=0x0) at /test/10.6_dbg/sql/sql_insert.cc:3748
      #9  0x00005585fe531c44 in mysql_execute_command (thd=0x14d790000db8) at /test/10.6_dbg/sql/sql_parse.cc:4567
      #10 0x00005585fe44ba23 in sp_instr_stmt::exec_core (this=0x14d7900449d0, thd=<optimized out>, nextp=0x14d7e05ca19c) at /test/10.6_dbg/sql/sp_head.cc:3768
      #11 0x00005585fe459213 in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x14d790044a18, thd=thd@entry=0x14d790000db8, nextp=nextp@entry=0x14d7e05ca19c, open_tables=open_tables@entry=false, instr=instr@entry=0x14d7900449d0) at /test/10.6_dbg/sql/sp_head.cc:3495
      #12 0x00005585fe459dde in sp_instr_stmt::execute (this=0x14d7900449d0, thd=0x14d790000db8, nextp=0x14d7e05ca19c) at /test/10.6_dbg/sql/sp_head.cc:3674
      #13 0x00005585fe451a00 in sp_head::execute (this=this@entry=0x14d790042f00, thd=thd@entry=0x14d790000db8, merge_da_on_success=merge_da_on_success@entry=true) at /test/10.6_dbg/sql/sp_head.cc:1437
      #14 0x00005585fe453aa2 in sp_head::execute_procedure (this=0x14d790042f00, thd=thd@entry=0x14d790000db8, args=0x14d790005e40) at /test/10.6_dbg/sql/sp_head.cc:2449
      #15 0x00005585fe522a9f in do_execute_sp (thd=thd@entry=0x14d790000db8, sp=sp@entry=0x14d790042f00) at /test/10.6_dbg/sql/sql_parse.cc:2930
      #16 0x00005585fe52774a in Sql_cmd_call::execute (this=0x14d790012768, thd=0x14d790000db8) at /test/10.6_dbg/sql/sql_parse.cc:3176
      #17 0x00005585fe5354c6 in mysql_execute_command (thd=thd@entry=0x14d790000db8) at /test/10.6_dbg/sql/sql_parse.cc:5858
      #18 0x00005585fe51c072 in mysql_parse (thd=thd@entry=0x14d790000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14d7e05cb3d0) at /test/10.6_dbg/sql/sql_parse.cc:7881
      #19 0x00005585fe52a1ec in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14d790000db8, packet=packet@entry=0x14d790008d39 "CALL p", packet_length=packet_length@entry=6) at /test/10.6_dbg/sql/sql_class.h:1293
      #20 0x00005585fe52d52d in do_command (thd=0x14d790000db8) at /test/10.6_dbg/sql/sql_parse.cc:1348
      #21 0x00005585fe6897fc in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55860220ec48, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
      #22 0x00005585fe689f03 in handle_one_connection (arg=arg@entry=0x55860220ec48) at /test/10.6_dbg/sql/sql_connect.cc:1312
      #23 0x00005585feb3f88f in pfs_spawn_thread (arg=0x558602149cb8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
      #24 0x000014d7e1f3e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #25 0x000014d7e1b2d293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.2.37 (dbg), 10.3.28 (dbg), 10.4.18 (dbg), 10.5.9 (dbg), 10.6.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.37 (opt), 10.3.28 (opt), 10.4.18 (opt), 10.5.9 (opt), 10.6.0 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.50 (dbg), 5.6.50 (opt), 5.7.32 (dbg), 5.7.32 (opt), 8.0.22 (dbg), 8.0.22 (opt)

      Attachments

        Activity

          People

            shulga Dmitry Shulga
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.