fix(pgdelta): unmarshal stuckStatements as objects, not strings#5085
Closed
SAY-5 wants to merge 4 commits intosupabase:mainfrom
Closed
fix(pgdelta): unmarshal stuckStatements as objects, not strings#5085SAY-5 wants to merge 4 commits intosupabase:mainfrom
SAY-5 wants to merge 4 commits intosupabase:mainfrom
Conversation
* feat(declarative): add tests for skipping config updates when PgDelta is enabled - These tests verify that the configuration remains unchanged when PgDelta is enabled, ensuring the declarative directory is the source of truth. - Updated the WriteDeclarativeSchemas function to reflect the new behavior regarding PgDelta configuration. * fix(declarative): DSL change due to upgrade
* fix * test --------- Co-authored-by: Andrew Valleteau <avallete@users.noreply.github.com>
Per supabase#5080, ApplyResult.StuckStatements was typed as []string but pgdelta_declarative_apply.ts emits an array of objects with shape `{ statement, code, message, isDependencyError }`. The mismatch caused json.Unmarshal to fail with: failed to parse pg-delta apply output: json: cannot unmarshal object into Go struct field ApplyResult.stuckStatements of type string This obscured the real underlying error (pgmq schema not present in the shadow DB) behind an unrelated parsing failure. Introduce a StuckStatement struct that captures the documented fields, retains the inner statement payload as json.RawMessage so future schema changes don't break parsing, and updates the stderr output to render code + message for each stuck statement instead of dumping a Go-struct repr. Closes supabase#5080
Member
|
Thank's for the contribution, but that should already be taken care of in this PR: #5082 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per #5080,
ApplyResult.StuckStatementswas typed as[]stringbutpgdelta_declarative_apply.tsemits an array of objects with shape{ statement, code, message, isDependencyError }. The mismatch causedjson.Unmarshalto fail with:This obscured the real underlying error (the
pgmqschema not being present in the shadow DB) behind an unrelated parsing failure, and left users with no way to inspect which statements got stuck.This PR introduces a
StuckStatementstruct that captures the documented fields, retains the inner statement payload asjson.RawMessageso future schema changes don't break parsing, and updates the stderr output to rendercode + messagefor each stuck statement instead of dumping a Go-struct repr.Closes #5080