Redshift dialect: `--` and `/*` inside an operator should start a comment
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
調査の方向性
Start from the tokenizer's operator lexing, where HashMinus (#-) and PGSquareRoot (|/, ||/) are produced, and check how the Redshift dialect handles them compared with Postgres. Reproduce with select 2 #--' 3, pg_backend_pid() --' and select 9 |/*'*/ 2, which should produce a comment rather than a token. Done when both queries parse as a comment-terminated operator, matching the Postgres rule that -- and /* cannot appear inside an operator.
索引モデルが issue の本文から書いたものです。
説明
Postgres-family lexers never let -- or /* be part of an operator; the operator ends there and a comment starts. sqlparser lexes #- (and |/, ||/) as one token first, which leaves the rest of the comment marker behind.
select 2 #--'
3, pg_backend_pid() --'
- sqlparser 0.64.0:
HashMinus,Minus, then the string'\n 3, pg_backend_pid() --'; parses asSELECT 2 #- -'...'. - Redshift: two columns,
1(that is,2 # 3) and1073905994.
The same happens with /*: select 9 |/*'*/ 2, pg_backend_pid() --' returns 11 and the pid on Redshift, while sqlparser lexes PGSquareRoot, Mul, a string, and fails to parse.
Postgres documents the rule under "Operators" (https://www.postgresql.org/docs/8.0/sql-syntax.html#SQL-SYNTAX-OPERATORS): "-- and /* cannot appear anywhere in an operator name, since they will be taken as the start of a comment." Postgres's own dialect in sqlparser likely has the same gap.
- 主要言語
- Rust
- スター
- 3.5k
- フォーク
- 805
- 平均マージ
- 2日 3時間
- マージ済み PR(30日)
- 116
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/datafusion-sqlparser-rs のほかの issue
-
Redshift
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/datafusion-sqlparser-rs#2959 ·
メンテナーはふだん 1 日以内に返信
-
Redshift
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
apache/datafusion-sqlparser-rs#2958 ·
メンテナーはふだん 1 日以内に返信
-
PostgreSQL
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/datafusion-sqlparser-rs#2862 ·
メンテナーはふだん 1 日以内に返信
-
PostgreSQL
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/datafusion-sqlparser-rs#2861 ·
メンテナーはふだん 1 日以内に返信
-
PostgreSQL
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
apache/datafusion-sqlparser-rs#2858 ·
メンテナーはふだん 1 日以内に返信
apache/datafusion-sqlparser-rs の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
storytold/vectorcraft#7242 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
ci
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
aliasfoxkde/FireCraft#146 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
P3
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
HerringtonDarkholme/hd-lang#1770 ·
メンテナーはふだん 1 日以内に返信