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

Escape characters in ranges should be printable in readable format in the optimizer trace

    XMLWordPrintable

Details

    Description

      Here is a test case:
      CREATE TABLE t1(i INT PRIMARY KEY, b CHAR(10), INDEX i_b(b));
      INSERT INTO t1 VALUES (1, 'ab\n');
      INSERT INTO t1 VALUES (2, 'ab\n');

      set optimizer_trace=1;
      EXPLAIN SELECT * FROM t1 WHERE b IN ('ab\n');

      select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;

                        "analyzing_range_alternatives": {
                          "range_scan_alternatives": [
                            {
                              "index": "i_b",
                              "ranges": ["ab
       <= b <= ab
      "],
                              "rowid_ordered": true,
                              "using_mrr": false,
                              "index_only": false,
                              "rows": 2,
                              "cost": 3.632,
                              "chosen": true
                            }
                          ],
      

      It would be good to see the range as 'ab\n' <= b <= 'ab\n'

      select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;

      select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
      JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
      NULL
      Warnings:
      Warning	4036	Character disallowed in JSON in argument 1 to function 'json_extract' at position 2582
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            varun Varun Gupta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.