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

AddColumn with inline checkConstraint on an existing table double-applies the constraint (42710)

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp, postgresql
領域
backend, databases

調査の方向性

Read the planner, AddColumnOperation, and AddCheckConstraintOperation, then reproduce the existing-table migration using the declarative schema example in the issue. Done means the new column is applied successfully, its check constraint is present once, and rerunning the migration does not fail with PostgreSQL error 42710.

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

説明

What happened

DataProviderMigrate (postgres, additive phase) over a declarative schema where an existing table gains one new column that carries a checkConstraint:

      - name: workspace_size
        type: Text
        checkConstraint: "workspace_size IS NULL OR workspace_size IN ('small','medium','large')"

Plan and outcome:

Phase: all — applying 2 of 2 operation(s):
  AddColumnOperation
  AddCheckConstraintOperation
Error: migration apply failed: 42710: constraint "agent_configs_workspace_size_chk" for relation "agent_configs" already exists

The whole apply rolls back, so the column never lands: information_schema.columns and pg_constraint both show nothing afterwards, and every re-run fails the same way.

Diagnosis

AddColumnOperation already emits the column-level CHECK (named <table>_<column>_chk), and the planner also schedules a separate AddCheckConstraintOperation for the same declaration with the same name. On a fresh CREATE TABLE this does not happen, which is why the same YAML pattern works for columns declared at table-creation time.

Expected

One of:

  • the planner emits only AddColumnOperation (with the inline check) when the column is new, or
  • AddColumnOperation emits the bare column and leaves the check to AddCheckConstraintOperation.

Environment

  • Postgres 17 (Supabase)
  • Provider: postgres
  • Consumer: Nimblesite/NimblesiteAgenticPlatform migrations/schema.yaml, table agent_configs
主要言語
C#
スター
68
フォーク
4
平均マージ
36分
マージ済み PR(30日)
9

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

Nimblesite/DataProvider のほかの issue

Nimblesite/DataProvider の issue をすべて見る

似ている issue

C# の issue をもっと見る

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

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