cloudflare / cloudflare/developer-platform

Errors when running sqlite files with D1 are very unhelpful

Đang mở
#13 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
product:d1
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
1
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### What versions & operating system are you using?

wrangler 4.26.0, macos

### Please provide a link to a minimal reproduction

_No response_

### Describe the Bug

Here's the output I see now when I have a simple bug in my sql syntax

```
0 ➤ npx wrangler@latest d1 execute pydantic-test --local --file=schema.sql

⛅️ wrangler 4.26.0
───────────────────
🌀 Executing on local database pydantic-test (test) from .wrangler/state/v3/d1:
🌀 To execute on your remote database, add a --remote flag to your wrangler command.

✘ [ERROR] near "limit": syntax error at offset 205: SQLITE_ERROR

If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
? Would you like to report this error to Cloudflare? Wrangler's output and the error details will be shared with the Wrangler team to help us diagnose and fix the issue. › (Y/n)
```

1. The error gives an offset, not a line number
2. The offset is relative the expression, not the file - making it almost impossible to use!
3. The incorrect code is not show
4. You're constantly suggesting I create issues when I just have an error in my sql syntax

Compare this to the error I get from sqlite:

```
➤ sqlite3 test.edb < schema.sql
Parse error near line 77: near "limit": syntax error
lete old usage beyond one month CHECK (usage <= limit) );
error here ---^
```

### Please provide any relevant error logs

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện `npx wrangler@latest d1 execute ... --local --file=schema.sql` với SQL không hợp lệ được mô tả, sau đó so sánh đầu ra của nó với ví dụ sqlite3. Truy vết điểm vào của việc báo cáo lỗi D1 cục bộ; công việc được hoàn tất khi các lỗi cú pháp xác định dòng tương đối với tệp, hiển thị ngữ cảnh SQL liên quan và không hiển thị lời nhắc báo cáo vấn đề.

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

Đánh giá

Công nghệ
sql, sqlite
Lĩnh vực
cli, databases
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

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.