AddColumn emits an inline CHECK, then the planner adds it again — 42710 on every ALTER-path migration
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
調査の方向性
Start at AddColumnOperation and the diff engine that schedules AddCheckConstraintOperation, then reproduce the ALTER-path migration against an existing PostgreSQL table using the schema fragment in the report. Done means a column with checkConstraint produces one constraint and the migration applies without error 42710.
索引モデルが issue の本文から書いたものです。
説明
Version
DataProviderMigrate 0.9.12-beta (current latest release).
Summary
Adding a column that declares checkConstraint to an existing table plans two
operations that both create the same constraint. The second one fails and the whole
migration rolls back, so the change can never be applied.
Phase: all — applying 4 of 4 operation(s):
AddColumnOperation
AddCheckConstraintOperation
CreateRlsPolicyOperation
CreateRlsPolicyOperation
Error: migration apply failed: 42710: constraint "tool_calls_execution_target_chk"
for relation "tool_calls" already exists
AddColumnOperation already emits the CHECK inline as part of the ADD COLUMN, and
the diff engine independently notices the constraint is absent and schedules
AddCheckConstraintOperation for it too.
Proof that AddColumn is the one creating it
After the failed run, the database has neither the column nor the constraint —
the apply is transactional and rolled back cleanly:
execution_target column : None | nullable: None | default: None
constraints : []
So the constraint did not pre-exist. It existed by the time operation 2 ran, and the
only thing between those points is operation 1.
Schema fragment
- name: execution_target
type: Text
isNullable: false
defaultValue: "'client'::text"
checkConstraint: "execution_target IN ('client', 'workspace')"
Why this is easy to miss
It only occurs on the ALTER path. On a fresh database the table is created with the
column inline, so AddColumnOperation never runs and no duplicate is planned. Our
test suite migrates a throwaway Postgres from scratch on every run and is completely
green; only the migration against the long-lived database fails. Any project whose
tests build the schema fresh will pass CI and then fail in production.
Expected
Adding a column with checkConstraint to an existing table applies once. Either
AddColumnOperation emits the bare column and leaves the CHECK to
AddCheckConstraintOperation, or the diff engine does not schedule a constraint that
the column operation already carries.
Impact
There is no way to express this without working around the bug — checkConstraint on
a column is the only form the schema language offers (we use it 19 times), and
--phase structural still contains both operations. The migration is simply
unappliable, which blocks the deploy that depends on it.
- 主要言語
- C#
- スター
- 68
- フォーク
- 4
- 平均マージ
- 50分
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Nimblesite/DataProvider のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 92/100
Nimblesite/DataProvider#137 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Nimblesite/DataProvider#72 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
Nimblesite/DataProvider#121 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
Nimblesite/DataProvider#108 ·
メンテナーはふだん 1 日以内に返信
-
A check constraint the schema cannot name can never be retired, and keeps enforcing the old ruleオープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
Nimblesite/DataProvider#107 ·
メンテナーはふだん 1 日以内に返信
Nimblesite/DataProvider の issue をすべて見る
似ている issue
-
kronos:develop:queued priority:P0
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
nopSolutions/nopCommerce#8512 ·
メンテナーはふだん 4 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
modelcontextprotocol/csharp-sdk#2061 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信