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 Postgres UPDATE ... LIMIT bug #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

erikkessler1
Copy link

This PR fixes the bug described in #143.

The subquery returns 1 row so there is no need to use "IN" as the "=" operator will work just fine. Additionally, using "=" doesn't allow the query planner to choose a plan that can sidestep the LIMIT.

The subquery should only return a single row so there is no need to
use IN. Using "=" avoids a situation where the planner can sidestep
the LIMIT in the subquery.
@stephanvd
Copy link

We're having the same problem using postgres 11.

SaitoJP added a commit to SaitoJP/delayed_job_active_record that referenced this pull request Jul 8, 2020
The subquery should only return a single row so there is no need to
use IN. Using "=" avoids a situation where the planner can sidestep
the LIMIT in the subquery.
collectiveidea#169
sauy7 added a commit to fishbrain/delayed_job_active_record that referenced this pull request Sep 11, 2021
albanpeignier added a commit to enroute-mobi/chouette-core that referenced this pull request Oct 11, 2022
@geekontheway
Copy link

Having same issue and this merge request will resolve it, why don't we merge it in to master branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants