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

Assertion `(m_ptr == __null) == item->null_value' failed in VDec::VDec

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Cannot Reproduce
    • 10.4(EOL), 10.5(EOL)
    • N/A
    • JSON

    Description

      USE test;
      CREATE TABLE t (h INT);
      INSERT INTO t VALUES (0);
      SELECT CAST(JSON_EXTRACT(h,0) as DECIMAL(1,1)) FROM t;
      

      Leads to:

      10.4.15 eae968f62d285de97ed607c87bc131cd863d5d03 (Debug)

      mysqld: /test/10.4_dbg/sql/sql_type.cc:195: VDec::VDec(Item*): Assertion `(m_ptr == __null) == item->null_value' failed.
      

      10.4.15 eae968f62d285de97ed607c87bc131cd863d5d03 (Debug)

      Core was generated by `/test/MD110820-mariadb-10.4.15-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:57
      [Current thread is 1 (Thread 0x14d4bd137700 (LWP 459005))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x00005642bd8508a6 in my_write_core (sig=sig@entry=6) at /test/10.4_dbg/mysys/stacktrace.c:482
      #2  0x00005642bcfcccdc in handle_fatal_signal (sig=6) at /test/10.4_dbg/sql/signal_handler.cc:343
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x000014d4bb3ce8b1 in __GI_abort () at abort.c:79
      #6  0x000014d4bb3be42a in __assert_fail_base (fmt=0x14d4bb545a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5642bd99a9f8 "(m_ptr == __null) == item->null_value", file=file@entry=0x5642bd99a598 "/test/10.4_dbg/sql/sql_type.cc", line=line@entry=195, function=function@entry=0x5642bd9a0b40 <VDec::VDec(Item*)::__PRETTY_FUNCTION__> "VDec::VDec(Item*)") at assert.c:92
      #7  0x000014d4bb3be4a2 in __GI___assert_fail (assertion=assertion@entry=0x5642bd99a9f8 "(m_ptr == __null) == item->null_value", file=file@entry=0x5642bd99a598 "/test/10.4_dbg/sql/sql_type.cc", line=line@entry=195, function=function@entry=0x5642bd9a0b40 <VDec::VDec(Item*)::__PRETTY_FUNCTION__> "VDec::VDec(Item*)") at assert.c:101
      #8  0x00005642bcedc5d6 in VDec::VDec (this=0x14d4bd133480, item=0x14d49506d7c0) at /test/10.4_dbg/sql/sql_type.cc:195
      #9  0x00005642bd0555c4 in Item_decimal_typecast::val_decimal (this=0x14d49506d8c0, dec=0x14d4bd133548) at /test/10.4_dbg/sql/item_func.cc:976
      #10 0x00005642bcedc572 in VDec::VDec (this=0x14d4bd133540, item=0x14d49506d8c0) at /test/10.4_dbg/sql/sql_type.cc:194
      #11 0x00005642bd07a2c9 in Item_decimal_typecast::val_str (this=<optimized out>, str=0x14d4bd133680) at /test/10.4_dbg/sql/item_func.h:1237
      #12 0x00005642bcee5e6c in Type_handler::Item_send_str (this=<optimized out>, item=0x14d49506d8c0, protocol=0x14d495015638, buf=<optimized out>) at /test/10.4_dbg/sql/sql_type.cc:6913
      #13 0x00005642bceece2b in Type_handler_decimal_result::Item_send (this=<optimized out>, item=<optimized out>, protocol=<optimized out>, buf=<optimized out>) at /test/10.4_dbg/sql/sql_type.h:4344
      #14 0x00005642bcc2f7f9 in Item::send (this=0x14d49506d8c0, protocol=0x14d495015638, buffer=0x14d4bd133650) at /test/10.4_dbg/sql/item.h:1038
      #15 0x00005642bcc2d64d in Protocol::send_result_set_row (this=this@entry=0x14d495015638, row_items=row_items@entry=0x14d49506d2a0) at /test/10.4_dbg/sql/protocol.cc:1035
      #16 0x00005642bccbdbea in select_send::send_data (this=0x14d49506e9e8, items=@0x14d49506d2a0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d49506d9c8, last = 0x14d49506d9c8, elements = 1}, <No data fields>}) at /test/10.4_dbg/sql/sql_class.cc:3010
      #17 0x00005642bcd7bbec in end_send (join=0x14d49506ea10, join_tab=0x14d4950704b0, end_of_records=<optimized out>) at /test/10.4_dbg/sql/sql_select.cc:21589
      #18 0x00005642bcd56660 in evaluate_join_record (join=join@entry=0x14d49506ea10, join_tab=join_tab@entry=0x14d495070108, error=error@entry=0) at /test/10.4_dbg/sql/sql_select.cc:20620
      #19 0x00005642bcd64f1e in sub_select (join=0x14d49506ea10, join_tab=0x14d495070108, end_of_records=<optimized out>) at /test/10.4_dbg/sql/sql_select.cc:20400
      #20 0x00005642bcd96a70 in do_select (procedure=0x0, join=0x14d49506ea10) at /test/10.4_dbg/sql/sql_select.cc:19938
      #21 JOIN::exec_inner (this=this@entry=0x14d49506ea10) at /test/10.4_dbg/sql/sql_select.cc:4473
      #22 0x00005642bcd9704d in JOIN::exec (this=this@entry=0x14d49506ea10) at /test/10.4_dbg/sql/sql_select.cc:4255
      #23 0x00005642bcd953f3 in mysql_select (thd=thd@entry=0x14d495015070, tables=<optimized out>, wild_num=0, fields=@0x14d49506d2a0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d49506d9c8, last = 0x14d49506d9c8, elements = 1}, <No data fields>}, conds=0x0, og_num=<optimized out>, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14d49506e9e8, unit=0x14d495018f98, select_lex=0x14d49506d158) at /test/10.4_dbg/sql/sql_select.cc:4687
      #24 0x00005642bcd9571e in handle_select (thd=thd@entry=0x14d495015070, lex=lex@entry=0x14d495018ed8, result=result@entry=0x14d49506e9e8, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.4_dbg/sql/sql_select.cc:410
      #25 0x00005642bcd0e3c6 in execute_sqlcom_select (thd=thd@entry=0x14d495015070, all_tables=0x14d49506da38) at /test/10.4_dbg/sql/sql_parse.cc:6355
      #26 0x00005642bcd1979a in mysql_execute_command (thd=thd@entry=0x14d495015070) at /test/10.4_dbg/sql/sql_parse.cc:3889
      #27 0x00005642bcd24090 in mysql_parse (thd=thd@entry=0x14d495015070, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14d4bd136460, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:7896
      #28 0x00005642bcd26920 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14d495015070, packet=packet@entry=0x14d495057071 "", packet_length=packet_length@entry=53, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:1834
      #29 0x00005642bcd2a35b in do_command (thd=0x14d495015070) at /test/10.4_dbg/sql/sql_parse.cc:1352
      #30 0x00005642bce568b6 in do_handle_one_connection (connect=connect@entry=0x14d4ba035790) at /test/10.4_dbg/sql/sql_connect.cc:1412
      #31 0x00005642bce569d6 in handle_one_connection (arg=0x14d4ba035790) at /test/10.4_dbg/sql/sql_connect.cc:1316
      #32 0x000014d4bc3356db in start_thread (arg=0x14d4bd137700) at pthread_create.c:463
      #33 0x000014d4bb4afa3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.4.15 (dbg), 10.5.6 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.47 (dbg), 10.1.47 (opt), 10.2.34 (dbg), 10.2.34 (opt), 10.3.25 (dbg), 10.3.25 (opt), 10.4.15 (opt), 10.5.6 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

      10.3.25 bafc5c1321a7dff5f2da292111bf98fed9d1658d (Debug)

      10.3.25>SELECT CAST(JSON_EXTRACT(h,0) as DECIMAL(1,1)) FROM t;
      +-----------------------------------------+
      | CAST(JSON_EXTRACT(h,0) as DECIMAL(1,1)) |
      +-----------------------------------------+
      |                                    NULL |
      +-----------------------------------------+
      1 row in set, 1 warning (0.001 sec)
       
      10.3.25>SHOW WARNINGS;
      +---------+------+----------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                          |
      +---------+------+----------------------------------------------------------------------------------+
      | Warning | 4042 | Syntax error in JSON path in argument 2 to function 'json_extract' at position 1 |
      +---------+------+----------------------------------------------------------------------------------+
      1 row in set (0.000 sec)
      

      Attachments

        Activity

          People

            rucha174 Rucha Deodhar
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.