Restore CLUSTER ON statements after their referenced indexes#907
Merged
Conversation
CLUSTER ON statements after their referenced indexes
tsg
approved these changes
Jun 29, 2026
Collaborator
Author
|
@copilot resolve the merge conflicts in this pull request |
…fter-indexes # Conflicts: # pkg/snapshot/generator/postgres/schema/pgdumprestore/snapshot_pg_dump_restore_generator.go # pkg/snapshot/generator/postgres/schema/pgdumprestore/snapshot_pg_dump_restore_generator_test.go # pkg/stream/integration/snapshot_pg_integration_test.go
Contributor
Collaborator
Author
|
@copilot resolve the merge conflicts in this pull request |
…fter-indexes # Conflicts: # pkg/snapshot/generator/postgres/schema/pgdumprestore/snapshot_pg_dump_restore_generator_test.go # pkg/stream/integration/snapshot_pg_integration_test.go
Contributor
Resolved in 6f15fd9. The new conflicts came from |
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
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
|
This was referenced Jun 30, 2026
kvch
added a commit
that referenced
this pull request
Jul 6, 2026
…) (#966) Backports the following snapshot/restore fixes from `main` to the `v1.1.x` release branch. | PR | Commit | Fix | |----|--------|-----| | #906 | 2cf967b | Skip legacy public PL/pgSQL handler functions on snapshot restore | | #908 | 5f1d6e3 | Refresh materialized views after data restore | | #909 | bce8ea8 | Use `ONLY` for CTID snapshot queries to exclude inherited child rows | | #907 | 1b090aa | Restore `CLUSTER ON` statements after their referenced indexes | | #910 | 6b3bb8a | Type `int4range`/`int8range` values before insert/COPY | --------- Co-authored-by: dand <daniel.dent@borderconnect.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
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.
Problem
ALTER TABLE ... CLUSTER ON <index>references an index. During snapshot restore it could be emitted before the index was created, causing the restore to fail.Fix
Route
ALTER TABLE ... CLUSTER ON ...statements into the indices/constraints restore phase so the referenced index always exists first.Testing
TestSnapshotGenerator_parseDumpMovesClusterOnToConstraints(asserts CLUSTER ON is ordered after CREATE INDEX)Test_SnapshotToPostgres_ClusteredIndexgo test ./pkg/snapshot/generator/postgres/schema/pgdumprestore/...Cherry-picked from @danddanddand (
fix/restore-cluster-after-indexes).