cloudflare / cloudflare/developer-platform

Errors when running sqlite files with D1 are very unhelpful

Abierto
#13 3 comentarios 0 reacciones 0 asignados Ver en GitHub
product:d1
Lenguaje dominante
Sin datos de lenguaje
Estrellas
1
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### 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_

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza reproduciendo `npx wrangler@latest d1 execute ... --local --file=schema.sql` con el SQL mal formado descrito y, después, compara su salida con el ejemplo de sqlite3. Rastrea el punto de entrada de los informes de errores de D1 local; el trabajo estará terminado cuando los errores de sintaxis identifiquen la línea relativa al archivo, muestren el contexto SQL relevante y eviten la solicitud de informar del problema.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
sql, sqlite
Área
cli, databases
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.