Fix pg_class join style and keep regression coverage#177
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses false-positive diffs caused by under-constrained pg_description joins by ensuring classoid = 'pg_class'::regclass is included where pg_class-backed objects (tables, columns, indexes, sequences, views) are joined for comments. It also refactors several SQL query strings into dedicated builder functions and adds regression tests to ensure the classoid filters remain present.
Changes:
- Add
pg_description.classoid = 'pg_class'::regclasspredicates to relevant comment joins (tables, table columns, indexes, sequences, views, view columns). - Refactor standalone/bulk dump query construction into
build_*_queryhelper functions. - Add unit tests asserting the
pg_classclassoidfilter is included in the generated queries.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| app/src/dump/table.rs | Adds pg_class classoid filter for column/index comment joins; extracts index bulk query builder; adds regression tests. |
| app/src/dump/core.rs | Extracts table/view/sequence query builders and adds pg_class classoid filters for object/column comment joins; adds regression tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nettrash
left a comment
There was a problem hiding this comment.
Issue is real.
Fix is correct.
|
@iBarBuba Please add this information to CHANGELOG. v1.0.19 |
@nettrash Added ✅
|
What
Dump::build_sequences_standalone_queryinapp/src/dump/core.rsTable::build_indexes_bulk_queryinapp/src/dump/table.rspg_descriptionjoins scoped to relation comments by filtering on:pg_description.classoid = 'pg_class'::regclasspg_description.objsubid = 0pg_classclassoid filter:build_sequences_standalone_query_filters_by_pg_classbuild_indexes_bulk_query_filters_by_pg_classWhy
Existing database objects can appear in diffs when comment lookups join
pg_descriptionwithout narrowing the catalog class. The fix keeps sequence and index comments tied to
pg_classentries, avoiding accidental matches from other catalogs that can reuse thesame object identifier value.
Validation
cargo fmt --manifest-path app/Cargo.tomlcargo test --manifest-path app/Cargo.toml(801 passed,0 failed)git diff --check(clean)Links
Closes #176