apache / apache/datafusion-sqlparser-rs

[Postgres]: `?` JSON operator cannot be parsed without a space after the field name

Aperta
#1,992 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
3.5k
Fork
772
Merge medio
4g 9h
PR unite (30g)
17

Descrizione

When using `PostgreSqlDialect`, the question mark cannot be parsed if it is not followed by a space, whereas postgres accepts the query. The following code panics when parsing `broken`:

```rust
fn main() {
let broken = r#"SELECT user?'adress' FROM my_table"#;
let working = r#"SELECT user? 'adress' FROM my_table"#;

let working_parsed =
sqlparser::parser::Parser::parse_sql(&sqlparser::dialect::PostgreSqlDialect {}, working)
.expect("Failed to parse SQL query");
println!("{:?}", working_parsed);

let broken_parsed =
sqlparser::parser::Parser::parse_sql(&sqlparser::dialect::PostgreSqlDialect {}, broken)
.expect("Failed to parse SQL query");
println!("{:?}", broken_parsed);
}
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia eseguendo l'esempio fornito di Parser::parse_sql con PostgreSqlDialect e confronta le due forme della query. Traccia il modo in cui il parser gestisce ? accanto al nome del campo, quindi aggiungi la copertura per entrambe le forme di spaziatura e conferma che l'operatore JSON di PostgreSQL venga analizzato senza panic.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
postgresql, rust
Ambito
compilers, databases
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.