[MDEV-30354] Optimizer trace does not escape double quotes, produces invalid JSON Created: 2023-01-06  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 0
Labels: Papercut, beginner-friendly


 Description   

SET optimizer_trace= 'enabled=on';
SELECT LENGTH("a");
SELECT json_valid(trace), trace FROM information_schema.optimizer_trace;

10.4 f97f6955

json_valid(trace)	trace
0	{
  "steps": [
    {
      "join_preparation": {
        "select_id": 1,
        "steps": [
          {
            "expanded_query": "select octet_length('a') AS `LENGTH("a")`"
          }
        ]
      }
    },
    {
      "join_optimization": {
        "select_id": 1,
        "steps": []
      }
    },
    {
      "join_execution": {
        "select_id": 1,
        "steps": []
      }
    }
  ]
}



 Comments   
Comment by Hari Hara Naveen S [ 2023-01-07 ]

What do we want the expanded_query to be?

Something like "select octet_length(\"a\") AS `LENGTH(\"a\")`"?

Comment by Daniel Black [ 2023-07-06 ]

yes. Look for "expanded_query" in sql/opt_trace.cc

Generated at Thu Feb 08 10:15:37 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.