parse_drop silently discards TEMPORARY and PERSISTENT for most object types
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Rust
- Star
- 3.5k
- Fork
- 805
- Merge trung bình
- 2 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 116
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/datafusion-sqlparser-rs
-
Redshift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/datafusion-sqlparser-rs#2959 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Redshift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/datafusion-sqlparser-rs#2958 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PostgreSQL
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
apache/datafusion-sqlparser-rs#2862 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PostgreSQL
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
apache/datafusion-sqlparser-rs#2861 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PostgreSQL
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
apache/datafusion-sqlparser-rs#2858 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/datafusion-sqlparser-rs
Issue tương tự
-
area:schema documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ElectronicWave/Elemental#252 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dekobon/big-code-analysis#1887 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Shell中文符号输入异常Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày