phpmyadmin / phpmyadmin/sql-parser
Parser fails for updates that include subqueries for source tables
オープン
まだ誰も着手していません。
bug
- 主要言語
- PHP
- スター
- 485
- フォーク
- 119
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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"
}
]
}
]
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供された UPDATE クエリを SQL パーサーに通して実行し、その出力を issue に示されている table、subquery、SET、WHERE の想定構造と比較します。subquery を含む UPDATE のテーブル参照がどのようにトークン化および解析されるかを追跡し、その後、このクエリの回帰テストを追加または更新して、解析された構造を検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php, sql
- 領域
- compilers, databases
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100