[feature request] PostgreSQL: FOR NO KEY UPDATE / FOR KEY SHARE, PREPARE TRANSACTION family and DO blocks have no AST production

Đang mở
#2,914 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
postgresql, rust
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Start with src/ast/mod.rs and the PostgreSQL parser under src/parser/**; compare the existing FOR UPDATE / FOR SHARE locking clause and PREPARE statement productions. Add AST support and parsing for the missing locking strengths, prepared transaction statements, and DO blocks, then verify they produce matchable AST nodes with PostgreSqlDialect.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

PostgreSQL

Summary

sqlparser-rs 0.64.0 parses SELECT ... FOR UPDATE / FOR SHARE, but has no production for the other two PostgreSQL row-lock strengths, and no production for any PostgreSQL two-phase-commit statement or the anonymous DO block. These are the four surfaces PostgreSQL's own regression/isolation suites exercise and they cannot be reached through the AST at all.

Environment

  • sqlparser 0.64.0 (crate source, src/ast/mod.rs, src/parser/**)
  • PostgreSQL dialect (PostgreSqlDialect)
  • Consumer: a PostgreSQL-wire-compatible engine driving REL_16_4 pg_regress + isolation suites against sqlparser's AST

What is missing

PostgreSQL statement Expected Actual (0.64.0)
SELECT ... FOR NO KEY UPDATE a locking-clause AST node no production; FOR UPDATE and FOR SHARE only
SELECT ... FOR KEY SHARE a locking-clause AST node no production
PREPARE TRANSACTION 'gid' a statement node no production
COMMIT PREPARED 'gid' / ROLLBACK PREPARED 'gid' statement nodes no production
DO $$ ... $$ (anonymous code block) a statement node no Statement::Do variant

Evidence (0.64.0 crate source)

  • for no key update / for key share: 0 matches anywhere under src/ (case-insensitive, whitespace-tolerant).
  • PREPARE TRANSACTION: 0 matches anywhere under src/.
  • pub enum Statement has 151 variants; the only matches for the interesting prefixes are Prepare (the SQL PREPARE name AS ... statement), Lock, LockTables (MySQL) — there is no Do and no prepared-transaction variant.

Expected behaviour

Parsing the statements above with PostgreSqlDialect yields a statement/locking-clause node the consumer can match on, the same way SELECT ... FOR UPDATE already does.

Actual behaviour

The parser rejects them, so a downstream engine cannot represent the feature through the AST and is forced either to pre-scan the SQL text (which is what we want to avoid) or to leave the feature unimplemented.

Why it matters here

pg_regress's lock, select and transactions files and the isolation suite's prepared-transactions*, lock-committed-*, nowait-*, skip-locked-* specs all start with these statements. Without an AST face, the consumer cannot answer them at all.

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/datafusion-sqlparser-rs

Tất cả issue của apache/datafusion-sqlparser-rs

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.