parse_drop silently discards TEMPORARY and PERSISTENT for most object types
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Start in src/parser/mod.rs at Parser::parse_drop, where TEMPORARY and PERSISTENT are consumed before the object type is read. Use the existing Statement::Drop and DROP SECRET branches, which keep these flags, as the model. Done means DROP TEMPORARY FUNCTION keeps its flag in a dialect that supports it, and the other object types reject the keyword with a parse error. Check the dialect tests for MySQL, Generic and DuckDB.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
parse_drop consumes TEMPORARY (MySQL, Generic, DuckDB) and PERSISTENT (DuckDB) before it reads the object type. Only Statement::Drop and DROP SECRET keep these flags. Every other branch drops them, so the statement parses without error but loses the keyword when printed:
| Input | Dialect | Output |
|---|---|---|
DROP TEMPORARY FUNCTION f |
Generic | DROP FUNCTION f |
DROP TEMPORARY TRIGGER tr ON t |
Generic | DROP TRIGGER tr ON t |
DROP TEMPORARY PROCEDURE p |
Generic | DROP PROCEDURE p |
DROP PERSISTENT TABLE t |
DuckDB | DROP TABLE t |
The same applies to POLICY, CONNECTOR, DOMAIN, EXTENSION and OPERATOR.
In most cases the input isn't valid SQL anyway, so it should fail instead of being accepted. DROP TEMPORARY FUNCTION is real syntax in Spark/Databricks and Hive, so there the parser drops meaningful information.
Expected
Reject TEMPORARY/PERSISTENT for object types that don't support them, and keep the flag where a dialect does support it, e.g. DROP TEMPORARY FUNCTION.
Code
src/parser/mod.rs, Parser::parse_drop
Spotted while reviewing #2434
- 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/datafusion-sqlparser-rs
-
Redshift
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apache/datafusion-sqlparser-rs#2959 ·
I maintainer di solito rispondono entro 1 giorno
-
Redshift
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/datafusion-sqlparser-rs#2958 ·
I maintainer di solito rispondono entro 1 giorno
-
PostgreSQL
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
apache/datafusion-sqlparser-rs#2862 ·
I maintainer di solito rispondono entro 1 giorno
-
PostgreSQL
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/datafusion-sqlparser-rs#2861 ·
I maintainer di solito rispondono entro 1 giorno
-
PostgreSQL
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
apache/datafusion-sqlparser-rs#2858 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/datafusion-sqlparser-rs
Issue simili
-
area:schema documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ElectronicWave/Elemental#252 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dekobon/big-code-analysis#1887 ·
I maintainer di solito rispondono entro 1 giorno
-
Shell中文符号输入异常Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno