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

Assertion `!result' failed in convert_const_to_int upon 2nd execution of PS

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (field1 BIGINT DEFAULT -1);
      INSERT INTO t1 VALUES (1),(2); # optional, fails either way
      CREATE VIEW v1 AS SELECT DISTINCT field1 FROM t1;
      PREPARE stmt FROM 'SELECT * FROM v1 WHERE field1 <=> NULL';
      EXECUTE stmt;
      EXECUTE stmt;
       
      # Cleanup
      DEALLOCATE PREPARE stmt;
      DROP VIEW v1;
      DROP TABLE t1;
      

      10.4 1ad8693a

      mysqld: /data/src/10.4/sql/item_cmpfunc.cc:369: bool convert_const_to_int(THD*, Item_field*, Item**): Assertion `!result' failed.
      200304 13:28:18 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f37483e8e67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x55a6e54cb333 "!result", file=file@entry=0x55a6e54cb2e8 "/data/src/10.4/sql/item_cmpfunc.cc", line=line@entry=369, function=function@entry=0x55a6e54cc060 <convert_const_to_int(THD*, Item_field*, Item**)::__PRETTY_FUNCTION__> "bool convert_const_to_int(THD*, Item_field*, Item**)") at assert.c:92
      #7  0x00007f37483e8f12 in __GI___assert_fail (assertion=0x55a6e54cb333 "!result", file=0x55a6e54cb2e8 "/data/src/10.4/sql/item_cmpfunc.cc", line=369, function=0x55a6e54cc060 <convert_const_to_int(THD*, Item_field*, Item**)::__PRETTY_FUNCTION__> "bool convert_const_to_int(THD*, Item_field*, Item**)") at assert.c:101
      #8  0x000055a6e49bfac8 in convert_const_to_int (thd=0x7f3730000af0, field_item=0x7f3730065a60, item=0x7f3730065c90) at /data/src/10.4/sql/item_cmpfunc.cc:369
      #9  0x000055a6e49bfd63 in Item_func::convert_const_compared_to_int_field (this=0x7f3730065bf8, thd=0x7f3730000af0) at /data/src/10.4/sql/item_cmpfunc.cc:400
      #10 0x000055a6e49bff33 in Item_func::setup_args_and_comparator (this=0x7f3730065bf8, thd=0x7f3730000af0, cmp=0x7f3730065cc0) at /data/src/10.4/sql/item_cmpfunc.cc:420
      #11 0x000055a6e49c00fa in Item_bool_rowready_func2::fix_length_and_dec (this=0x7f3730065bf8) at /data/src/10.4/sql/item_cmpfunc.cc:453
      #12 0x000055a6e49c4b52 in Item_func_equal::fix_length_and_dec (this=0x7f3730065bf8) at /data/src/10.4/sql/item_cmpfunc.cc:1778
      #13 0x000055a6e4a01dd9 in Item_func::fix_fields (this=0x7f3730065bf8, thd=0x7f3730000af0, ref=0x7f37300137a8) at /data/src/10.4/sql/item_func.cc:370
      #14 0x000055a6e4502857 in Item::fix_fields_if_needed (this=0x7f3730065bf8, thd=0x7f3730000af0, ref=0x7f37300137a8) at /data/src/10.4/sql/item.h:958
      #15 0x000055a6e4502885 in Item::fix_fields_if_needed_for_scalar (this=0x7f3730065bf8, thd=0x7f3730000af0, ref=0x7f37300137a8) at /data/src/10.4/sql/item.h:962
      #16 0x000055a6e4586f21 in Item::fix_fields_if_needed_for_bool (this=0x7f3730065bf8, thd=0x7f3730000af0, ref=0x7f37300137a8) at /data/src/10.4/sql/item.h:966
      #17 0x000055a6e4583443 in setup_conds (thd=0x7f3730000af0, tables=0x7f3730065380, leaves=..., conds=0x7f37300137a8) at /data/src/10.4/sql/sql_base.cc:8363
      #18 0x000055a6e465dfda in setup_without_group (thd=0x7f3730000af0, ref_pointer_array=..., tables=0x7f3730065380, leaves=..., fields=..., all_fields=..., conds=0x7f37300137a8, order=0x0, group=0x0, win_specs=..., win_funcs=..., hidden_group_fields=0x7f3730013687, reserved=0x7f37300650c4) at /data/src/10.4/sql/sql_select.cc:684
      #19 0x000055a6e4660d81 in JOIN::prepare (this=0x7f37300133a0, tables_init=0x7f3730065380, wild_num=0, conds_init=0x7f3730065bf8, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7f3730064dc0, unit_arg=0x7f3730063290) at /data/src/10.4/sql/sql_select.cc:1239
      #20 0x000055a6e466d8a5 in mysql_select (thd=0x7f3730000af0, tables=0x7f3730065380, wild_num=0, fields=..., conds=0x7f3730065bf8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7f3730066648, unit=0x7f3730063290, select_lex=0x7f3730064dc0) at /data/src/10.4/sql/sql_select.cc:4629
      #21 0x000055a6e465d5fa in handle_select (thd=0x7f3730000af0, lex=0x7f37300631d0, result=0x7f3730066648, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:420
      #22 0x000055a6e4623d4b in execute_sqlcom_select (thd=0x7f3730000af0, all_tables=0x7f3730065380) at /data/src/10.4/sql/sql_parse.cc:6359
      #23 0x000055a6e4619421 in mysql_execute_command (thd=0x7f3730000af0) at /data/src/10.4/sql/sql_parse.cc:3898
      #24 0x000055a6e4647bca in Prepared_statement::execute (this=0x7f3730062d70, expanded_query=0x7f3742591550, open_cursor=false) at /data/src/10.4/sql/sql_prepare.cc:4760
      #25 0x000055a6e464602c in Prepared_statement::execute_loop (this=0x7f3730062d70, expanded_query=0x7f3742591550, open_cursor=false, packet=0x0, packet_end=0x0) at /data/src/10.4/sql/sql_prepare.cc:4246
      #26 0x000055a6e4643aff in mysql_sql_stmt_execute (thd=0x7f3730000af0) at /data/src/10.4/sql/sql_prepare.cc:3363
      #27 0x000055a6e4619466 in mysql_execute_command (thd=0x7f3730000af0) at /data/src/10.4/sql/sql_parse.cc:3914
      #28 0x000055a6e4627e57 in mysql_parse (thd=0x7f3730000af0, rawbuf=0x7f3730013198 "EXECUTE stmt", length=12, parser_state=0x7f3742592160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7900
      #29 0x000055a6e461303a in dispatch_command (command=COM_QUERY, thd=0x7f3730000af0, packet=0x7f3730136221 "EXECUTE stmt", packet_length=12, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #30 0x000055a6e46116c7 in do_command (thd=0x7f3730000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #31 0x000055a6e479a933 in do_handle_one_connection (connect=0x55a6e73bad40) at /data/src/10.4/sql/sql_connect.cc:1412
      #32 0x000055a6e479a682 in handle_one_connection (arg=0x55a6e73bad40) at /data/src/10.4/sql/sql_connect.cc:1316
      #33 0x000055a6e51a157b in pfs_spawn_thread (arg=0x55a6e7329570) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #34 0x00007f374a3714a4 in start_thread (arg=0x7f3742593700) at pthread_create.c:456
      #35 0x00007f37484a5d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 5.5-10.5, with at least InnoDB, MyISAM, Aria.
      Also reproducible with stored procedures instead of prepared statements.
      No obvious problem on a non-debug build.

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              elenst Elena Stepanova
              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.