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

Assertion `0' failed in virtual bool Type_handler_row::Item_save_in_value(THD*, Item*, st_value*) const

Details

    Description

      DELIMITER $$
      CREATE PROCEDURE p0 (OUT a ROW(a INT,b INT)) 
      BEGIN 
        SET a=ROW(0,0);
      END; $$
      DELIMITER ;
      PREPARE s0 FROM 'CALL p0 (?)';
      EXECUTE s0 USING @a;
      

      Leads to:

      CS 10.11.12 91de54e098b179f033deb1ee61fc3d7d5997f588 (Debug) Build 10/02/2025

      mariadbd: /test/10.11_dbg/sql/sql_type.cc:7511: virtual bool Type_handler_row::Item_save_in_value(THD*, Item*, st_value*) const: Assertion `0' failed.
      

      CS 10.11.12 91de54e098b179f033deb1ee61fc3d7d5997f588 (Debug) Build 10/02/2025

      Core was generated by `/test/MD100225-mariadb-10.11.12-linux-x86_64-dbg/bin/mariadbd --no-defaults --m'.
      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 (Thread 0x151b6ffff6c0 (LWP 3294888))]
      (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  0x0000151b77c4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000151b77c288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000151b77c2881b in __assert_fail_base (fmt=0x151b77dd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55971b0088be "0", file=file@entry=0x55971aea02a8 "/test/10.11_dbg/sql/sql_type.cc", line=line@entry=7511, function=function@entry=0x55971aea0a18 "virtual bool Type_handler_row::Item_save_in_value(THD*, Item*, st_value*) const") at ./assert/assert.c:96
      #6  0x0000151b77c3b517 in __assert_fail (assertion=0x55971b0088be "0", file=0x55971aea02a8 "/test/10.11_dbg/sql/sql_type.cc", line=7511, function=0x55971aea0a18 "virtual bool Type_handler_row::Item_save_in_value(THD*, Item*, st_value*) const") at ./assert/assert.c:105
      #7  0x000055971a61899d in Type_handler_row::Item_save_in_value (this=<optimized out>, thd=<optimized out>, item=<optimized out>, value=0x151b6fffccd0) at /test/10.11_dbg/sql/sql_type.cc:7511
      #8  0x000055971a7042fe in Item::save_in_value (this=this@entry=0x151b1c015f80, thd=thd@entry=0x151b1c000d58, value=value@entry=0x151b6fffccd0)at /test/10.11_dbg/sql/item.h:1244
      #9  0x000055971a6f928a in Item_param::set_value (this=0x151b1c0442e8, thd=0x151b1c000d58, ctx=<optimized out>, it=<optimized out>)at /test/10.11_dbg/sql/item.cc:5155
      #10 0x000055971a3c6c6c in sp_head::bind_output_param (this=this@entry=0x151b1c0204b0, thd=thd@entry=0x151b1c000d58, arg_item=<optimized out>, arg_no=arg_no@entry=0, octx=octx@entry=0x151b1c013740, nctx=nctx@entry=0x151b1c015338)at /test/10.11_dbg/sql/sp_head.cc:2631
      #11 0x000055971a3c8dcb in sp_head::execute_procedure (this=0x151b1c0204b0, thd=thd@entry=0x151b1c000d58, args=0x151b1c043358)at /test/10.11_dbg/sql/sp_head.cc:2509
      #12 0x000055971a45d682 in do_execute_sp (thd=thd@entry=0x151b1c000d58, sp=sp@entry=0x151b1c0204b0) at /test/10.11_dbg/sql/sql_parse.cc:3089
      #13 0x000055971a4616e7 in Sql_cmd_call::execute (this=0x151b1c0440f0, thd=0x151b1c000d58) at /test/10.11_dbg/sql/sql_parse.cc:3334
      #14 0x000055971a46cc5d in mysql_execute_command (thd=0x151b1c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=true)at /test/10.11_dbg/sql/sql_parse.cc:6167
      #15 0x000055971a4916af in Prepared_statement::execute (this=this@entry=0x151b1c013188, expanded_query=expanded_query@entry=0x151b6fffdd10, open_cursor=open_cursor@entry=false)at /test/10.11_dbg/sql/sql_prepare.cc:5281
      #16 0x000055971a493236 in Prepared_statement::execute_loop (this=this@entry=0x151b1c013188, expanded_query=expanded_query@entry=0x151b6fffdd10, open_cursor=open_cursor@entry=false, packet=packet@entry=0x0, packet_end=packet_end@entry=0x0) at /test/10.11_dbg/sql/sql_prepare.cc:4682
      #17 0x000055971a493665 in mysql_sql_stmt_execute (thd=thd@entry=0x151b1c000d58)at /test/10.11_dbg/sql/sql_prepare.cc:3714
      #18 0x000055971a46771a in mysql_execute_command (thd=thd@entry=0x151b1c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/10.11_dbg/sql/sql_parse.cc:4028
      #19 0x000055971a46d7dd in mysql_parse (thd=thd@entry=0x151b1c000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x151b6fffe2f0)at /test/10.11_dbg/sql/sql_parse.cc:8188
      #20 0x000055971a46edf6 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x151b1c000d58, packet=packet@entry=0x151b1c00b029 "EXECUTE s0 USING @a", packet_length=packet_length@entry=19, blocking=blocking@entry=true)at /test/10.11_dbg/sql/sql_parse.cc:1905
      #21 0x000055971a4702ca in do_command (thd=thd@entry=0x151b1c000d58, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1418
      #22 0x000055971a5966cf in do_handle_one_connection (connect=<optimized out>, connect@entry=0x559723d92548, put_in_cache=put_in_cache@entry=true)at /test/10.11_dbg/sql/sql_connect.cc:1386
      #23 0x000055971a5968f4 in handle_one_connection (arg=0x559723d92548)at /test/10.11_dbg/sql/sql_connect.cc:1298
      #24 0x0000151b77c9caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #25 0x0000151b77d29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

       

      Bug confirmed present in:
      MariaDB: 10.5.29 (dbg), 10.6.21 (dbg), 10.11.12 (dbg), 11.4.6 (dbg), 11.7.2 (dbg), 11.8.0 (dbg), 11.8.1 (dbg), 12.0.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.5.29 (opt), 10.6.21 (opt), 10.11.12 (opt), 11.4.6 (opt), 11.7.2 (opt), 11.8.0 (opt), 11.8.1 (opt), 12.0.0 (opt)

      OUT parameters in CREATE FUNCTION

      Since 10.8 the problem is also repeatable with functions (in addition to procedures):

      DELIMITER $$
      CREATE OR REPLACE FUNCTION f0(OUT f0a ROW(a INT,b INT)) RETURNS BOOLEAN
      BEGIN 
        SET f0a=ROW(1,2);
        RETURN FALSE;
      END; $$
      CREATE OR REPLACE PROCEDURE p1()
      BEGIN
        PREPARE stmt FROM 'DO f0(?)';
        EXECUTE stmt USING @a;
      END $$
      DELIMITER ;
      CALL p1;
      

      Attachments

        Issue Links

          Activity

            There are no comments yet on this issue.

            People

              bar Alexander Barkov
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.