cloudflare / cloudflare/developer-platform
Errors when running sqlite files with D1 are very unhelpful
- 主要言語
- 言語のデータがありません
- スター
- 1
- フォーク
- 0
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
### 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_
コントリビューションガイド
調査の方向性
まず、説明されている不正な SQL を使って `npx wrangler@latest d1 execute ... --local --file=schema.sql` を再現し、その出力を sqlite3 の例と比較します。ローカル D1 のエラー報告のエントリーポイントを追跡します。構文エラーがファイル相対の行を特定し、関連する SQL コンテキストを表示し、問題報告のプロンプトを表示しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- sql, sqlite
- 領域
- cli, databases
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100