-
Notifications
You must be signed in to change notification settings - Fork 883
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
Add workaround for pg_depend bug in PG < 15.4 #7508
Add workaround for pg_depend bug in PG < 15.4 #7508
Conversation
PostgreSQL versions prior to 15.4 didn't properly update object dependencies when setting a new access method on a table. The fix for the bug is found in this commit: postgres/postgres@97d8910 The `hypercore_create` test failed on buggy PG versions (e.g., 15.0) due to wrong contents of pg_depend showing up in test output when converting a table from Hypercore TAM back to regular heap. This change adds a workaround that updates pg_depend with the correct information when compiling against PG versions that suffer from the bug.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7508 +/- ##
==========================================
+ Coverage 80.06% 82.14% +2.07%
==========================================
Files 190 230 +40
Lines 37181 43190 +6009
Branches 9450 10868 +1418
==========================================
+ Hits 29770 35478 +5708
- Misses 2997 3387 +390
+ Partials 4414 4325 -89 ☔ View full report in Codecov by Sentry. |
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.
Nice catch!
#if (PG_VERSION_NUM < 150004) | ||
/* Fix for PostgreSQL bug where pg_depend was not updated to reflect the | ||
* new dependency between AM and relation. See related PG fix here: | ||
* https://github.com/postgres/postgres/commit/97d89101045fac8cb36f4ef6c08526ea0841a596 */ | ||
if (changeDependencyFor(RelationRelationId, relid, AccessMethodRelationId, amoid, new_amoid) != | ||
1) | ||
elog(ERROR, | ||
"could not change access method dependency for relation \"%s.%s\"", | ||
get_namespace_name(get_rel_namespace(relid)), | ||
get_rel_name(relid)); | ||
#endif |
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.
Since this was reported in 16beta1 it seems like it should be fixed in all GA versions of PostgreSQL after 16.0, so double-checking that it is indeed the case and this is the result. You might want to add a comment to why this is not necessary to check for later versions, but IMHO this is entirely optional since it was fixed before the GA release of the other versions.
mats@fury:~/repos/postgres$ git log --grep "Fix pg_depend entry" --oneline
97d8910104 Fix pg_depend entry to AMs after ALTER TABLE .. SET ACCESS METHOD
mats@fury:~/repos/postgres$ git tag --contains 97d8910104
REL_16_0
REL_16_1
REL_16_2
REL_16_3
REL_16_4
REL_16_5
REL_16_6
REL_16_BETA3
REL_16_RC1
REL_17_0
REL_17_1
REL_17_2
REL_17_BETA1
REL_17_BETA2
REL_17_BETA3
REL_17_RC1
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.
Thank you for double-checking.
Automated backport to 2.17.x not done: cherry-pick failed. Git status
|
PostgreSQL versions prior to 15.4 didn't properly update object dependencies when setting a new access method on a table. The fix for the bug is found in this commit:
postgres/postgres@97d8910
The
hypercore_create
test failed on buggy PG versions (e.g., 15.0) due to wrong contents of pg_depend showing up in test output when converting a table from Hypercore TAM back to regular heap.This change adds a workaround that updates pg_depend with the correct information when compiling against PG versions that suffer from the bug.
Disable-check: force-changelog-file
Disable-check: approval-count