parse_drop silently discards TEMPORARY and PERSISTENT for most object types
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 55/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- Rust
- Étoiles
- 3.5k
- Forks
- 805
- Merge moyen
- 2 j 3 h
- PR mergées (30 j)
- 116
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/datafusion-sqlparser-rs
-
Redshift
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
apache/datafusion-sqlparser-rs#2959 ·
Les mainteneurs répondent en général sous 1 jour
-
Redshift
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
apache/datafusion-sqlparser-rs#2958 ·
Les mainteneurs répondent en général sous 1 jour
-
PostgreSQL
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
apache/datafusion-sqlparser-rs#2862 ·
Les mainteneurs répondent en général sous 1 jour
-
PostgreSQL
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
apache/datafusion-sqlparser-rs#2861 ·
Les mainteneurs répondent en général sous 1 jour
-
PostgreSQL
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
apache/datafusion-sqlparser-rs#2858 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de apache/datafusion-sqlparser-rs
Issues similaires
-
area:schema documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
ElectronicWave/Elemental#252 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
dekobon/big-code-analysis#1887 ·
Les mainteneurs répondent en général sous 1 jour
-
Shell中文符号输入异常Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour