Subquery in expressions support
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by examining the existing expression-parsing path and the regular parser described in the examples. Determine how a separate ExpressionParser could represent and extract subqueries while preserving compatibility, then verify the SELECT and WHERE IN examples produce usable parsed subqueries.
Written by the indexing model from the issue text.
Description
It seems to subqueries are poorly supported
Some examples first:
They are not parsed at all
SELECT * FROM (SELECT * FROM b) a
results in
...
PhpMyAdmin\SqlParser\Components\Expression Object
(
[database] =>
[table] =>
[column] =>
[expr] => (SELECT * FROM b)
[alias] => a
[function] =>
[subquery] => SELECT
)
...
not even extracted properly (see #254)
SELECT * FROM a WHERE a.field IN (SELECT * FROM b)
results in
...
...
PhpMyAdmin\SqlParser\Components\Condition Object
(
[identifiers] => Array
(
[0] => a
[1] => field
[2] => b
)
[isOperator] =>
[expr] => a.field IN (SELECT * FROM b)
)
...
So I have an idea. May be there must be separate ExpressionParser generating AST for expression? Those (including me) who needed parsed expression can use it (and extract subselects, and parse it with regular parser), and there will be no compatibility break.
Does it sounds as a good plan? If it does, I would like to implement it.
- Dominant language
- PHP
- Stars
- 485
- Forks
- 119
- PR merge metrics
- No merged PRs in 30d
Contributor guide
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.
More from phpmyadmin/sql-parser
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
phpmyadmin/sql-parser#655 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
phpmyadmin/sql-parser#666 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
phpmyadmin/sql-parser#662 · 2 reactions ·
-
kind/support
Difficulty 3/5 1-2 days Newbie friendliness 45/100
phpmyadmin/sql-parser#653 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 70/100
phpmyadmin/sql-parser#649 ·
All issues in phpmyadmin/sql-parser
Similar issues
-
status/awaiting_triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
WordPress/plugin-check#1486 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
az-digital/az_quickstart#6019 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
grokability/snipe-it#19688 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100