Migration error caret is missing or misplaced when the statement contains multibyte characters
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 88/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- postgresql, typescript
Línea de trabajo
Comienza con markError en apps/cli/src/command-internal/migration-apply.ts y la prueba unitaria existente que comprueba el comportamiento basado en bytes. Reproduce el offset con un carácter multibyte en una línea de migración anterior y, después, verifica que la prueba pase y que el cursor aparezca debajo del carácter indicado por PostgreSQL en la línea correcta.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Affected area: Migrations
Supabase CLI version: current develop (d38ccd7e)
Operating system: Any. Reproduced with a unit test on Linux.
Installation method: Built from source
Command
supabase db push
Actual output
When a migration statement fails, the CLI prints the statement and a caret under the position that PostgreSQL reports. If an earlier line of the statement contains multibyte characters, the caret is missing or printed under the wrong line.
For example, with this statement in a migration:
insert into notes (body) values ('éééééééé'),
(foo bar);
PostgreSQL reports the error position as a 1-based count of characters into the statement. markError compares that count with the UTF-8 byte length of each line, so the first line, which is longer in bytes than in characters, absorbs part of the offset. The output shows the statement without a caret, or with the caret under the wrong line.
Expected behavior
The caret appears under the character that PostgreSQL reports, on the correct line, regardless of the characters used on earlier lines.
Steps to reproduce
- Add a migration whose statement has a multibyte character on an early line and a syntax error on a later line, as shown above.
- Run
supabase db pushagainst a database. - Read the error output.
Additional context
The PostgreSQL protocol documentation states that the error position is measured in characters, not bytes. markError in apps/cli/src/command-internal/migration-apply.ts uses utf8ByteLength(line), and an existing unit test asserts the byte behavior. Measuring each line in code points fixes the offset. A unit test that calls markError with a multibyte first line fails on develop and passes with the change.
I have a fix with a unit test ready and can open a PR if this is open for contribution.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.4k
- Forks
- 526
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 327
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de supabase/cli
-
supabase db reset intermittently fails: temporary Realtime init job races with the running Realtime service on "schema_migrations_pkey"Posiblemente ocupada @7ttp la tomó hoy. Abierto🐛 Bug supabase/cli
supabase/cli#6915 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
🐛 Bug supabase/cli
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
🐛 Bug supabase/cli
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
🐛 Bug supabase/cli
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
secrets set --env-file prints secret values in its parse errorPosiblemente ocupada @7ttp la tomó hace 4 días. Abierto🐛 Bug supabase/cli
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
supabase/cli#6847 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de supabase/cli
Issues similares
-
area/frontend good first issue kind/cooldown
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
voidzero-dev/oxc-angular-compiler#511 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
langchain-ai/deepagentsjs#898 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
anomalyco/models.dev#8509 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug documentation P2 UI/UX
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día