Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
12.3
-
Not for Release Notes
Description
Hi,
I found MariaDB produces invalid JSON in optimizer trace output when a table alias contains a double quote. The query itself runs successfully, but the generated trace is malformed because the double quote in the alias is not escaped correctly.
This test case can reproduce this:
CREATE TABLE t(a INT); |
INSERT INTO t VALUES (1); |
|
|
SET optimizer_trace='enabled=on'; |
|
|
SELECT * FROM t AS `a"b` WHERE a=1; |
|
|
-- a
|
-- 1
|
|
|
SELECT JSON_VALID(trace) AS optimizer_trace_is_valid_json FROM information_schema.optimizer_trace; -- 0
|
|
|
EXPLAIN FORMAT=JSON
|
SELECT * FROM t AS `a"b` WHERE a=1; |
|
|
EXPLAIN
|
{
|
"query_block": { |
"select_id": 1, |
"cost": 0.0110178, |
"nested_loop": [ |
{
|
"table": { |
"table_name": "a"b", |
"access_type": "ALL", |
"loops": 1, |
"rows": 1, |
"cost": 0.0110178, |
"filtered": 100, |
"attached_condition": "`a"b`.a = 1" |
}
|
}
|
]
|
}
|
}
|
I can reproduce this with the commit version f6e44c1b7819f9befa3824f07866822288231528 of MariaDB server on github repo.
Attachments
Issue Links
- duplicates
-
MDEV-39720 Optimizer Trace doesn't quote string values, may have invalid JSON
-
- In Review
-