-
Notifications
You must be signed in to change notification settings - Fork 166
Fix pg_dump for hash partitioning on enum columns #1176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Automatic partition handling: Auto-enables --load-via-partition-root when dumping partitioned tables with hash partitioning on enum types to prevent partition constraint violations after dump/reload cycles |
@@ -341,6 +341,7 @@ typedef struct _tableInfo | |||
bool dummy_view; /* view's real definition must be postponed */ | |||
bool postponed_def; /* matview must be postponed into post-data */ | |||
bool ispartition; /* is table a partition? */ | |||
bool unsafe_partitions; /* is it an unsafe partitioned table? */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
align please
@@ -2808,6 +2847,7 @@ dumpTableData(Archive *fout, const TableDataInfo *tdinfo) | |||
.owner = tbinfo->rolname, | |||
.description = "TABLE DATA", | |||
.section = SECTION_DATA, | |||
.createStmt = tdDefn, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add some test to ~src/bin/pg_dump ?
|
||
parentTbinfo = getRootTableInfo(tbinfo); | ||
copyFrom = fmtQualifiedDumpable(parentTbinfo); | ||
printfPQExpBuffer(copyBuf, "-- load via partition root %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not --load-via-partition-root
?
Fixes #ENUM_HASH_PARTITION_ISSUE
Fixes #PARALLEL_RESTORE_DEADLOCK
What does this PR do?
--load-via-partition-root
when dumping partitioned tables with hash partitioning on enum types to prevent partition constraint violations after dump/reload cycles--load-via-partition-root
with parallel restore from pg_dump documentationType of Change
Breaking Changes
None
Test Plan
Impact
Performance:
User-facing changes:
No significant change in dump performance for partitioned tables
Parallel restore stability improves overall throughput by eliminating deadlock points
Dependencies:
Users no longer need to manually specify --load-via-partition-root for enum hash partitions
Eliminates data corruption risks during pg_upgrade of partitioned tables
Provides clearer dump file annotation structure
Checklist
Additional Context
Compatibility note:
For existing dumps using --inserts + --load-via-partition-root:
Parallel restore might still trigger deadlocks (legacy file limitation)
Mitigation: Use single-threaded restore or regenerate dump files
CI Skip Instructions