Azure / Azure/postgresql

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

オープン
#33 コメント 9 件 リアクション 5 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

need-to-triage
主要言語
TypeScript
スター
25
フォーク
22
PR マージ指標
30日以内にマージされた PR はありません

説明

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:

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンク先の行にある src/PsqlFilesExecutor.ts を読み、psql stderr とその終了コードがどのように処理されているかを追跡します。issue に記載されたマイグレーションシナリオを再現し、NOTICE の出力では action が失敗しなくなっている一方で、実際の psql の失敗では引き続き失敗することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
postgresql, typescript
領域
databases, devops
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。