MariaDB: Parser fails on valid SQL with parenthesized JOIN expressions in FROM clause
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 15
- Forks
- 7
- Avg merge
- 13h 2m
- Merged PRs (30d)
- 23
Description
Summary
The MariaDB dialect parser fails to parse a valid MariaDB query when joined table expressions are wrapped in parentheses in the FROM clause.
MariaDB accepts this syntax, and it is commonly generated by tools such as SHOW CREATE VIEW, ORMs, or query builders.
Reproduction
SELECT
`o`.`id` AS `order_id`,
`c`.`name` AS `customer_name`,
sum(`oi`.`amount`) AS `total_amount`
FROM
(((`orders` `o`
JOIN `customers` `c` ON
((`o`.`customer_id` = `c`.`id`))))
LEFT JOIN `order_items` `oi` ON
((`o`.`id` = `oi`.`order_id`)))
GROUP BY
`o`.`id`,
`c`.`name`
parser failed error
expected SELECT, TABLE, VALUES, or '(' (line 1, column 108)
related text: SELECT `o`.`id` AS `order_id`, `c`.`name` AS `customer_name`, sum(`oi`.`amount`) AS `total_amount` FROM (((`orders` `o` JOIN `customers` `c` ON((`o`.`customer_id` = `c`.`id`)))) LEFT JOIN `order_items...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the MariaDB dialect parser and use the parenthesized JOIN query in the issue as the first reproduction. Add a regression test for this exact valid SQL, then run the parser test suite; done means the query parses successfully without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, mariadb, sql
- Domain
- compilers, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100