Azure / Azure/postgresql

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

Open
#33 9 comments 5 reactions 0 assignees View on GitHub
need-to-triage
Dominant language
TypeScript
Stars
25
Forks
22
PR merge metrics
No merged PRs in 30d

Description

`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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.