Skip to content

Fix/defer parse validated schema objects#1003

Merged
tsg merged 2 commits into
mainfrom
fix/defer-parse-validated-schema-objects
Jul 16, 2026
Merged

Fix/defer parse validated schema objects#1003
tsg merged 2 commits into
mainfrom
fix/defer-parse-validated-schema-objects

Conversation

@tsg

@tsg tsg commented Jul 16, 2026

Copy link
Copy Markdown
Member

While sorting DDL statements in the schema, the code was missing two kinds:

  • CREATE OR REPLACE VIEW (instead of just CREATE VIEW) which is used by pg_dump for circular views
  • SQL functions with BEGIN ATOMIC / RETURN (...)

There are two integration tests added that each were reproducing one the two cases above.

  • Test_SnapshotToPostgres_CircularDependencyView
  • Test_SnapshotToPostgres_SQLStandardFunctionBodies

Type of Change

Please select the relevant option(s):

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test coverage improvement
  • 🔨 Build/CI changes
  • 🧹 Code cleanup

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • All existing tests pass

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Code is well-commented
  • Documentation updated where necessary

Additional Notes

tsg added 2 commits July 16, 2026 10:43
While sorting DDL statements in the schema, the code was missing two kinds:
- CREATE OR REPLACE VIEW (instead of just CREATE VIEW)
- SQL functions with BEGIN ATOMIC / RETURN (...)
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/xataio/pgstream/pkg/snapshot/generator/postgres/schema/pgdumprestore 89.72% (+0.04%) 👍
github.com/xataio/pgstream/pkg/stream/integration 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/xataio/pgstream/pkg/snapshot/generator/postgres/schema/pgdumprestore/snapshot_pg_dump_restore_generator.go 85.78% (+0.47%) 464 (+42) 398 (+38) 66 (+4) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/xataio/pgstream/pkg/snapshot/generator/postgres/schema/pgdumprestore/snapshot_pg_dump_restore_generator_test.go
  • github.com/xataio/pgstream/pkg/stream/integration/snapshot_pg_integration_test.go

@tsg
tsg merged commit 589d6e4 into main Jul 16, 2026
8 checks passed
@tsg
tsg deleted the fix/defer-parse-validated-schema-objects branch July 16, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants