Display detailed explanation about tables affected by statement
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
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 の本文から書いたものです。
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sbdchd/squawk のほかの issue
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
bug core
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW オープンfuzz
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ClickHouse/ClickHouse#122114 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
linebender/vello_svg#90 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100