apache / apache/datafusion-sqlparser-rs
[Postgres] Parsing sequence of `SHOW` and `SET` is a bit off
- Lenguaje dominante
- Rust
- Estrellas
- 3.5k
- Forks
- 772
- Merge medio
- 4 d 9 h
- PR fusionados (30 d)
- 17
Descripción
```rust
Parser::parse_sql(&PostgreSqlDialect {}, "SHOW search_path; SHOW timezone; SET search_path TO public;").unwrap()
```
The above results in:
```rust
[
ShowVariable {
variable: [
Ident {
value: "search_path",
quote_style: None,
span: Span(Location(1,6)..Location(1,17)),
},
Ident {
value: "SHOW",
quote_style: None,
span: Span(Location(1,19)..Location(1,23)),
},
Ident {
value: "timezone",
quote_style: None,
span: Span(Location(1,24)..Location(1,32)),
},
Ident {
value: "SET",
quote_style: None,
span: Span(Location(1,34)..Location(1,37)),
},
Ident {
value: "search_path",
quote_style: None,
span: Span(Location(1,38)..Location(1,49)),
},
Ident {
value: "TO",
quote_style: None,
span: Span(Location(1,50)..Location(1,52)),
},
Ident {
value: "public",
quote_style: None,
span: Span(Location(1,53)..Location(1,59)),
},
],
},
]
```
Its `Display` impl results in `"SHOW search_path SHOW timezone SET search_path TO public"`
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Reproduce el problema con Parser::parse_sql, PostgreSqlDialect y la secuencia SHOW/SET mostrada aquí. Inspecciona cómo el dialecto de PostgreSQL analiza estas instrucciones y cómo se genera su salida de Display. Se considera terminado cuando las instrucciones se analizan como instrucciones separadas y se muestran sin absorber comandos posteriores en la primera variable SHOW.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- postgresql, rust, sql
- Área
- databases
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100