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

Optimizer Trace doesn't quote string values, may have invalid JSON

    XMLWordPrintable

Details

    • Q2/2026 Server Development, Q3/2026 Server Maintenance

    Description

      Run this mtr testcase:

      create table t2 (
        a varchar(100)
      );
       
      set optimizer_trace=1;
      explain
      select * from t2 where a < '"';
       
      set @trace=(select trace from information_schema.optimizer_trace);
      select json_valid(@trace);
      select @trace;
       
      drop table t2;
      

      You will get:

      select json_valid(@trace);
      json_valid(@trace)
      0
      

      This is because strings are not quoted when they are written into JSON:

                  "condition_processing": {
                    "condition": "WHERE",
                    "original_condition": "t2.a < '"'",
      

      Attachments

        Issue Links

          Activity

            People

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