Redshift dialect: `--` and `/*` inside an operator should start a comment
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 3.5k
- Fork
- 805
- Merge medio
- 2g 3h
- PR unite (30g)
- 116
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/datafusion-sqlparser-rs
-
Redshift
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apache/datafusion-sqlparser-rs#2959 ·
I maintainer di solito rispondono entro 1 giorno
-
Redshift
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/datafusion-sqlparser-rs#2958 ·
I maintainer di solito rispondono entro 1 giorno
-
PostgreSQL
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
apache/datafusion-sqlparser-rs#2862 ·
I maintainer di solito rispondono entro 1 giorno
-
PostgreSQL
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/datafusion-sqlparser-rs#2861 ·
I maintainer di solito rispondono entro 1 giorno
-
PostgreSQL
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
apache/datafusion-sqlparser-rs#2858 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/datafusion-sqlparser-rs
Issue simili
-
P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
HerringtonDarkholme/hd-lang#1770 ·
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
pbakaus/impeccable#1436 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
jonathanong/no-mistakes#3332 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
swc-project/swc-next-issues#310 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
swc-project/swc-ai-issues#653 ·