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: max revision query order #4096

Merged
merged 1 commit into from
Jun 27, 2023
Merged

fix: max revision query order #4096

merged 1 commit into from
Jun 27, 2023

Conversation

sjaanus
Copy link
Contributor

@sjaanus sjaanus commented Jun 27, 2023

The previous query utilized an ID limit for the "type" condition but not for the "feature_name" condition.

The improved query now correctly handles both conditions by ensuring that the "feature_name" is not null or the "type" matches the specified value, and then checking if the ID is greater than or equal to the provided value.

OLD: select max("id") from "events" where "feature_name" is not null or "type" = $1 and "id" >= $2 limit $3
NEW: select max("id") from "events" where ("feature_name" is not null or "type" = $1) and "id" >= $2 limit $3

@vercel
Copy link

vercel bot commented Jun 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Jun 27, 2023 8:57am
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Jun 27, 2023 8:57am

Copy link
Member

@ivarconr ivarconr left a comment

Choose a reason for hiding this comment

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

Nice catch!

@sjaanus sjaanus merged commit 803610a into main Jun 27, 2023
12 checks passed
@sjaanus sjaanus deleted the max-rev-fix branch June 27, 2023 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants