Parser fails for updates that include subqueries for source tables
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by running the supplied UPDATE query through the SQL parser and compare its output with the expected table, subquery, SET, and WHERE structure shown in the issue. Trace how UPDATE table references containing a subquery are tokenized and parsed, then add or update a regression test for this query and verify the parsed structure.
Written by the indexing model from the issue text.
Description
The SQL Parser fails to parse the following query:
update `table1` as e, (select * from table2) e2
set
e.`id` = e2.id,
where e.id=e2.id
It returns the output below. This appears to always be an issue when using subqueries in the table references.
[
{
"tables": [
{
"database": null,
"table": "table1",
"column": null,
"expr": "`table1`",
"alias": "e",
"function": null,
"subquery": null
}
],
"set": null,
"where": null,
"order": null,
"limit": null,
"options": {
"options": []
},
"first": 0,
"last": 10
},
{
"expr": [
{
"database": null,
"table": null,
"column": null,
"expr": "*",
"alias": null,
"function": null,
"subquery": null
}
],
"from": [
{
"database": null,
"table": "table2",
"column": null,
"expr": "table2",
"alias": null,
"function": null,
"subquery": null
}
],
"index_hints": null,
"partition": null,
"where": null,
"group": null,
"having": null,
"order": null,
"limit": null,
"procedure": null,
"into": null,
"join": null,
"union": [],
"end_options": null,
"options": {
"options": []
},
"first": 11,
"last": 21
},
{
"options": {
"options": []
},
"end_options": null,
"set": [
{
"column": "e.`id`",
"value": "e2.id"
}
],
"first": 22,
"last": 44,
"where": [
{
"identifiers": [
"e",
"id",
"e2"
],
"isOperator": false,
"expr": "e.id=e2.id"
}
]
}
]
- 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
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
a11y admissions.uiowa.edu needs grooming SiteImprove best practice
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Save States Menu Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
pluginsGLPI/datainjection#673 ·