Redshift dialect: `[...]` after an expression is a subscript, not a quoted identifier

Aperta
#2,960 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
50/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, sql

Direzione di ricerca

Start from RedshiftSqlDialect and find where the tokenizer or dialect treats [ as the start of a delimited identifier. Run the query from the issue through the parser and confirm that the Word comes back with quote_style: Some('[') and the bracket contents as its value. Done means that [ after an expression parses as a subscript in the Redshift dialect, while bracket-quoted identifiers still work in dialects that use them, and a regression test covers the case.

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

Descrizione

Redshift

RedshiftSqlDialect accepts [ as a delimited identifier quote. In Redshift, brackets after an expression index into a SUPER value, and identifiers are quoted only with double quotes.

select a[pg_backend_pid() - pg_backend_pid()] from (select json_parse('[1,2]') as a)
  • sqlparser 0.64.0: Word { value: "pg_backend_pid() - pg_backend_pid()", quote_style: Some('[') }; parses as SELECT a AS [pg_backend_pid() - pg_backend_pid()] FROM ....
  • Redshift: returns a = 1, i.e. a[0], so the bracket contents ran as an expression.

Docs: SUPER navigation (https://docs.aws.amazon.com/redshift/latest/dg/query-super.html) and identifier rules (https://docs.aws.amazon.com/redshift/latest/dg/r_names.html).

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/datafusion-sqlparser-rs

Tutte le issue di apache/datafusion-sqlparser-rs

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.