Redshift dialect: `--` and `/*` inside an operator should start a comment
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 55/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Rust
- Estrelas
- 3.5k
- Forks
- 805
- Merge médio
- 2d 3h
- PRs com merge (30d)
- 116
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de apache/datafusion-sqlparser-rs
-
Redshift
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
apache/datafusion-sqlparser-rs#2959 ·
Mantenedores costumam responder em até 1 dia
-
Redshift
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
apache/datafusion-sqlparser-rs#2958 ·
Mantenedores costumam responder em até 1 dia
-
PostgreSQL
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
apache/datafusion-sqlparser-rs#2862 ·
Mantenedores costumam responder em até 1 dia
-
PostgreSQL
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
apache/datafusion-sqlparser-rs#2861 ·
Mantenedores costumam responder em até 1 dia
-
PostgreSQL
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
apache/datafusion-sqlparser-rs#2858 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de apache/datafusion-sqlparser-rs
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
storytold/vectorcraft#7242 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
ci
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
aliasfoxkde/FireCraft#146 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
P3
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
HerringtonDarkholme/hd-lang#1770 ·
Mantenedores costumam responder em até 1 dia