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

Đang mở
#2,760 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.

  • #2791 của @slopgobblercobbler — đã đóng, không merge

Đá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
67/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust, sql

Hướng nghiên cứu

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.

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

Mô tả

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.

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.