MySQL: `REGEXP`/`RLIKE` followed by `NULL` is rejected or misparsed (regression in 0.59.0)

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

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #2791 di @slopgobblercobbler — chiusa senza merge

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
67/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust, sql

Direzione di ricerca

Start by tracing MySQL parsing for REGEXP/RLIKE and how the parser distinguishes NOT REGEXP from a NULL pattern; the issue identifies round-trip behavior as the regression. Compare the affected cases with the behavior in 0.58.0, then add regression tests for the three SQL statements shown. Done means each parses with NULL as the pattern and round-trips without consuming following tokens as part of the pattern.

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

Descrizione

MySQL Prolific Author

Since 0.59.0, a NULL pattern after REGEXP or RLIKE is consumed as if it were NOT NULL, and the next token becomes the pattern:

SELECT 'abc' REGEXP NULL
  -> sql parser error: Expected: an expression, found: EOF

SELECT a RLIKE NULL FROM t
  -> displays as: SELECT a RLIKE FROM AS t      (pattern is the identifier FROM, no FROM clause)

SELECT a NOT REGEXP NULL OR b FROM t
  -> displays as: SELECT a NOT REGEXP OR AS b FROM t

In 0.58.0 these parsed as Expr::RLike { pattern: Value(Null), .. } and round-tripped.

Tested on main e15e9abf (also 0.63.0; 0.58.0 is fine).

Found with a property-based fuzzer (round trip and statement-separation checks); I used AI assistance for triage and verified every case above.

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.