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

Assertion fixed() in Item_func_conv_charset::val_str with MEMBER OF on a pushed-down condition

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • N/A
    • 13.2
    • JSON, Optimizer
    • None

    Description

      MEMBER OF (MDEV-38591) aborts a debug build when its container is a function that needs a charset converter (JSON_ARRAY(), CONCAT()) and the condition is pushed down, either into a GROUP BY derived table or from HAVING into WHERE.

      Item_func_member_of::fix_length_and_dec() converts the container to utf8mb4 (MDEV-41586) and builds hidden Item_func_json_quote and Item_func_json_contains items that are not in args[]. After the pushdown clone, the converter evaluated by Item_func_json_contains::val_bool() is not fixed. The step that leaves it unfixed was not identified.

      Not reproducible when the container is a JSON column (no converter), or with condition_pushdown_for_derived=off (first query) / condition_pushdown_from_having=off (second query). The same query shape with JSON_CONTAINS does not crash.

      CREATE TABLE t1 (a INT, b INT);
      INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
       
      SELECT * FROM (SELECT a, b, COUNT(*) c FROM t1 GROUP BY a, b) d
      WHERE a MEMBER OF (JSON_ARRAY(b,9)) ORDER BY a;
       
      SELECT a, a MEMBER OF (JSON_ARRAY(a)) m FROM t1 GROUP BY a HAVING m ORDER BY a;
       
      DROP TABLE t1;
      

      13.2.0-MariaDB-asan-debug-log source revision: 20f9f1f5813ff2a84a6fb40587c7ca61127d6438
       
      mariadbd: /13.2/sql/item_strfunc.cc:3824: virtual String* Item_func_conv_charset::val_str(String*): Assertion `fixed()' failed.
       
      #13 Item_func_conv_charset::val_str at /13.2/sql/item_strfunc.cc:3824
      #14 Item::val_json at /13.2/sql/item.h:1712
      #15 Item_func_json_contains::val_bool at /13.2/sql/item_jsonfunc.cc:1999
      #16 Item_func_member_of::val_bool at /13.2/sql/item_jsonfunc.cc:6983
      #17 SQL_SELECT::skip_record at /13.2/sql/opt_range.h:1971
      #18 find_all_keys at /13.2/sql/filesort.cc:1005
      #19 filesort at /13.2/sql/filesort.cc:457
      #20 create_sort_index at /13.2/sql/sql_select.cc:29289
      #21 st_join_table::sort_table at /13.2/sql/sql_select.cc:26768
      #22 join_init_read_record at /13.2/sql/sql_select.cc:26684
      #23 sub_select at /13.2/sql/sql_select.cc:25629
      #24 do_select at /13.2/sql/sql_select.cc:25143
      #25 JOIN::exec_inner at /13.2/sql/sql_select.cc:5172
      #26 JOIN::exec at /13.2/sql/sql_select.cc:4960
      #27 mysql_select at /13.2/sql/sql_select.cc:5486
      #28 handle_select at /13.2/sql/sql_select.cc:652
      #29 execute_sqlcom_select at /13.2/sql/sql_parse.cc:6273
      #30 mysql_execute_command at /13.2/sql/sql_parse.cc:4044
      #31 mysql_parse at /13.2/sql/sql_parse.cc:8020
      #32 dispatch_command at /13.2/sql/sql_parse.cc:1903
      #33 do_command at /13.2/sql/sql_parse.cc:1437
      #34 do_handle_one_connection at /13.2/sql/sql_connect.cc:1529
      #35 handle_one_connection at /13.2/sql/sql_connect.cc:1441
      

      JarirBob FYI

      Attachments

        Issue Links

          Activity

            People

              danblack Daniel Black
              alice Alice Sherepa
              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.