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: Guard PG result with nil check #3511

Merged
merged 6 commits into from
Mar 11, 2024
Merged

Conversation

TonyCTHsu
Copy link
Contributor

@TonyCTHsu TonyCTHsu commented Mar 7, 2024

closes #3507

What does this PR do?

It is unclear how PG is yielding or returning nil instead of PG::Result.

I cannot reproduce the issue and here's a list what I have tried:

  1. I tried sending non-SELECT query (DELETE FROM...), PG::Result is returned
  2. I tried closing the connection object in the block, it raises exception
  3. I tried assigning the result object in the block and accessing it afterward, the PG::Result has a cleared status.
  4. I have tried clearing the result object in the block, it raises exception

Hence this PR implements:

  1. Guards result with nil check
  2. Tag with result before the block invokation

@github-actions github-actions bot added integrations Involves tracing integrations tracing labels Mar 7, 2024
@TonyCTHsu TonyCTHsu marked this pull request as ready for review March 7, 2024 14:21
@TonyCTHsu TonyCTHsu requested a review from a team as a code owner March 7, 2024 14:21
@TonyCTHsu TonyCTHsu self-assigned this Mar 7, 2024
@TonyCTHsu TonyCTHsu merged commit a9f0ef2 into master Mar 11, 2024
219 checks passed
@TonyCTHsu TonyCTHsu deleted the fix/pg-block-result-nil branch March 11, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrations Involves tracing integrations tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NoMethodError: undefined method 'ntuples' for nil with PG#async_exec
4 participants