Azure / Azure/postgresql

`psql` outputs it's `NOTICE` messages to stderr causing the action to fail

Abierto
#33 9 comentarios 5 reacciones 0 asignados Ver en GitHub
need-to-triage
Lenguaje dominante
TypeScript
Estrellas
25
Forks
22
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

`psql` outputs it's `NOTICE` messages to stderr causing the whole action to fail even if the exit code is `0`.
The offending lines of code:
https://github.com/Azure/postgresql/blob/f82d2b25075a9092d3ee987db9c77bcfc43fc6bc/src/PsqlFilesExecutor.ts#L27-L33
https://github.com/Azure/postgresql/blob/f82d2b25075a9092d3ee987db9c77bcfc43fc6bc/src/PsqlFilesExecutor.ts#L38-L40
`NOTICE`'s should be treated as warnings not errors those would be `EXCEPTION`'s.

Maybe there should be an option for choosing to ignore stderr and instead rely on the exit code of `psql`

It's trivial to get a `NOTICE` to fail the action.
Consider the following output generated by `dotnet ef migrations script -s Proj.Bootstrap -p Proj.Data --idempotent -o migration.sql`:
```SQL
CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" (
"MigrationId" character varying(150) NOT NULL,
"ProductVersion" character varying(32) NOT NULL,
CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId")
);

START TRANSACTION;
....
COMMIT;
```

If the `__EFMigrationsHistory` table already exists, the action fails, because `psql:/migration.sql:5: NOTICE: relation "__EFMigrationsHistory" already exists, skipping` gets written to stderr.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Lee src/PsqlFilesExecutor.ts en las líneas enlazadas para rastrear cómo se gestionan psql stderr y su código de salida. Reproduce el escenario de migración descrito en el issue y verifica que la salida NOTICE ya no haga fallar la action, mientras que los fallos reales de psql sigan haciéndolo.

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

Evaluación

Stack tecnológico
postgresql, typescript
Área
databases, devops
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.