Skip to content
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

Fix handling of oldtuple to match PG17 upstream #7340

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/import/ht_hypertable_modify.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,12 @@
* visible to our MVCC snapshot.
*/

#if PG17_GE
if (oldtuple != NULL)
ExecForceStoreHeapTuple(oldtuple, resultRelInfo->ri_oldTupleSlot,

Check warning on line 465 in src/import/ht_hypertable_modify.c

View check run for this annotation

Codecov / codecov/patch

src/import/ht_hypertable_modify.c#L465

Added line #L465 was not covered by tests
false);
else
#endif
Comment on lines +463 to +468
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this code in upstream was added by this commit postgres/postgres@5f2e179 so I think there are more things to import, no?

Also what this new code is fixing cause seems our regression tests are not reaching it per codecov?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was having a close look on it and actually we need to introduce support for MERGE ... WHEN NOT MATCHED BY SOURCE THEN ... for hypertables instead and it will require more work on ht_hypertable_modify.c

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is mostly to silence coverity

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the coverity was already silenced, no? I mean it will no hurt to merge this tiny PR but it still requires more work to sync it with upstream. I'm working on another PR to make this new merge clause work for hypertables because I want to use it on the new cagg refresh code using merge statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A previous commit I made added support for MERGE ... RETURNING ....
While working on the coverity fix, I realized that this code handling oldtuple was not added; that's what this fixes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kpan2034 would be good then mention it on the commit message and in the PR description to make clear the change you're proposing.

if (!table_tuple_fetch_row_version(resultRelInfo->ri_RelationDesc,
tupleid,
SnapshotAny,
Expand Down
Loading