AddColumn emits an inline CHECK, then the planner adds it again — 42710 on every ALTER-path migration
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C#
- Stelle
- 68
- Fork
- 4
- Merge medio
- 50m
- PR unite (30g)
- 2
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Nimblesite/DataProvider
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
Nimblesite/DataProvider#137 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Nimblesite/DataProvider#72 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Nimblesite/DataProvider#121 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
Nimblesite/DataProvider#108 ·
I maintainer di solito rispondono entro 1 giorno
-
A check constraint the schema cannot name can never be retired, and keeps enforcing the old ruleAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Nimblesite/DataProvider#107 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Nimblesite/DataProvider
Issue simili
-
kronos:develop:queued priority:P0
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
nopSolutions/nopCommerce#8512 ·
I maintainer di solito rispondono entro 4 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
modelcontextprotocol/csharp-sdk#2061 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno