-
Notifications
You must be signed in to change notification settings - Fork 686
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
PG17 Compatibility - Fix crash when pg_class is used in MERGE #7853
Merged
Conversation
This file contains 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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-13.0 #7853 +/- ##
=============================================
Coverage 89.48% 89.48%
=============================================
Files 276 276
Lines 60063 60066 +3
Branches 7524 7524
=============================================
+ Hits 53747 53752 +5
+ Misses 4166 4165 -1
+ Partials 2150 2149 -1 |
naisila
requested changes
Jan 20, 2025
naisila
reviewed
Jan 21, 2025
naisila
reviewed
Jan 21, 2025
naisila
changed the title
Issue 7846
PG17 Compatibility - Fix crash when pg_class is used in MERGE
Jan 21, 2025
naisila
approved these changes
Jan 21, 2025
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.
This pull request addresses Issue #7846, where specific MERGE queries on non-distributed and distributed tables can result in crashes in certain scenarios. The issue stems from the usage of
pg_class
catalog table, and theFilterShardsFromPgclass
function in Citus. This function goes through the query's jointree to hide the shards. However, in PG17, MERGE's join quals are in a separate structure calledmergeJoinCondition
. Therefore FilterShardsFromPgclass was not filtering correctly in aMERGE
command that involvespg_class
. To fix the issue, we handlemergeJoinCondition
separately in PG17.Relevant PG commit:
postgres/postgres@0294df2
Non-Distributed Tables:
A MERGE query involving a non-distributed table using
pg_catalog.pg_class
as the source may execute successfully but needs testing to ensure stability.Distributed Tables:
Performing a MERGE on a distributed table using
pg_catalog.pg_class
as the source raises an error:ERROR: MERGE INTO a distributed table from Postgres table is not yet supported
However, in some cases, this can lead to a server crash if the unsupported operation is not properly handled.
This is the test output from the same test conducted prior to the code changes being implemented.