Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Display detailed explanation about tables affected by statement

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
postgresql, rust
領域
databases, tooling

調査の方向性

Start by tracing the existing messages for foreign-key constraints, SET NOT NULL, and CREATE INDEX statements, using the SQL examples in the issue as entry points. Done means those cases report the affected table names, blocking behavior, and the requested suggestions, including the linked documentation where specified.

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

説明

enhancement

As mentioned in the adding-foreign-key-constraint rule, adding a foreign key like the following will lock both tables.

ALTER TABLE "email" ADD CONSTRAINT "fk_user"
    FOREIGN KEY ("user_id") REFERENCES "user" ("id");

The current error message is general and says,

help: Requires a table scan of the table you're altering and a SHARE ROW EXCLUSIVE lock on both tables, which blocks writes to both tables while your table is scanned

Instead, we can provide a more detailed error message:

help: statement will block writes to the "user" and "email" tables while the "email" table is scanned to verify the foreign key constraint.

ALTER TABLE "core_recipe" ALTER COLUMN "foo" SET NOT NULL;

current message:

note: Setting a column NOT NULL blocks reads while the table is scanned.
help: Use a check constraint instead.

better message:

note: Setting the column NOT NULL will block reads and writes to the "core_recipe" table while the table is scanned to verify the NOT NULL constraint.
suggestion: Use a check constraint added as NOT VALID instead. See https://squawkhq.com/docs/adding-not-nullable-field for examples.

CREATE INDEX CONCURRENTLY "email_idx" ON "app_user" ("email");

current message:

help: Consider wrapping in a transaction or adding a IF NOT EXISTS clause if the statment supports it.

better message:

note: Statement will error if index already exists
suggestion: create index with IF NOT EXISTS. For example, CREATE INDEX CONCURRENTLY IF NOT EXISTS ...

CREATE INDEX "email_idx" ON "app_user" ("email");

current message:

note: Creating an index blocks writes.
help: Create the index CONCURRENTLY.

better message:

note: Writes will be blocked for the "app_user" table while the index in built.
suggestion: Create the index CONCURRENTLY to prevent blocking writes. For example, CREATE INDEX CONCURRENTLY ...

主要言語
Rust
スター
1.2k
フォーク
70
平均マージ
54分
マージ済み PR(30日)
45

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

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

はじめの一歩

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

sbdchd/squawk のほかの issue

sbdchd/squawk の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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