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

[No reprepare] An error in UPDATE causes crash on 2nd PS exec

    XMLWordPrintable

Details

    Description

      Tried this on 11.7 (with fix for MDEV-36057) and 11.6 (which doesn't have it), other versions are probably affected too.

      Run this testcase:

      create table t (a int);
      insert into t values (1),(2);
      create table t100 (a int, b int);
      insert into t100 values (1,1);
      prepare s from 'update t100 set a = a +?  where b in (SELECT * FROM (select t1.* from t t1 join t t2 on(t1.a = t2.a)) sq WHERE "x"=0)';
      --error ER_TRUNCATED_WRONG_VALUE
      execute s using 1;
      --error ER_TRUNCATED_WRONG_VALUE
      execute s using 1;
      drop table t, t100;
      

      The second execution will crash:

      TABLE_LIST::is_recursive_with_table (this=0x8f8f8f8f8f8f8f8f)
      

      sql/sql_cte.cc:1371(TABLE_LIST::is_recursive_with_table())[0x56155a5a31b4]
      sql/sql_union.cc:2932(st_select_lex::cleanup())[0x56155a3e4e96]
      sql/item_subselect.cc:3975(subselect_single_select_engine::prepare(THD*))[0x56155a7c0508]
      sql/item_subselect.cc:294(Item_subselect::fix_fields(THD*, Item**))[0x56155a7b2197]
      sql/item_subselect.cc:3620(Item_in_subselect::fix_fields(THD*, Item**))[0x56155a7bf3ba]
      sql/item.h:1169(Item::fix_fields_if_needed(THD*, Item**))[0x56155a150480]
      sql/item.h:1177(Item::fix_fields_if_needed_for_scalar(THD*, Item**))[0x56155a1504ad]
      sql/item.h:1182(Item::fix_fields_if_needed_for_bool(THD*, Item**))[0x56155a1da905]
      sql/sql_base.cc:8885(setup_conds(THD*, TABLE_LIST*, List<TABLE_LIST>&, Item**))[0x56155a1d5b35]
      sql/sql_select.cc:955(setup_without_group(THD*, Bounds_checked_array<Item*>, TABLE_LIST*, List<TABLE_LIST>&, List<Item>&, List<Item>&, Item**, st_order*, st_order*, List<Window_spec>&, List<Item_window_func>&, bool*))[0x56155a2e7b3b]
      sql/sql_select.cc:1577(JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x56155a2ead4c]
      sql/sql_update.cc:3101(Sql_cmd_update::prepare_inner(THD*))[0x56155a3fbf09]
      sql/sql_select.cc:34240(Sql_cmd_dml::prepare(THD*))[0x56155a348548]
      sql/sql_select.cc:34293(Sql_cmd_dml::execute(THD*))[0x56155a3486cd]
      sql/sql_parse.cc:4428(mysql_execute_command(THD*, bool))[0x56155a284f9e]
      sql/sql_prepare.cc:5072(Prepared_statement::execute(String*, bool))[0x56155a2cbcf7]
      sql/sql_prepare.cc:4448(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x56155a2c9cd2]
      sql/sql_prepare.cc:3461(mysql_sql_stmt_execute(THD*))[0x56155a2c7256]
      sql/sql_parse.cc:3996(mysql_execute_command(THD*, bool))[0x56155a2838b6]
      sql/sql_parse.cc:7915(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x56155a290a9a]
      sql/sql_parse.cc:1904(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x56155a27d3fe]
      

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              psergei Sergei Petrunia
              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.