Repository navigation
Conversation
mathiusj
force-pushed
the
ae-task-5073-predicatebuilder-composite-tuple-where-w
branch
from
September 16, 2026 17:13
593e9b9 to
671b45d
Compare
Empty tuple value lists built an empty grouping, which generated invalid SQL. Return a no-match predicate while preserving other hash conditions. Co-authored-by: GPT-5.6-sol <noreply@openai.com> Orchestrated-by: ae <noreply@shopify.com>
mathiusj
force-pushed
the
ae-task-5073-predicatebuilder-composite-tuple-where-w
branch
from
September 17, 2026 17:57
671b45d to
b26106f
Compare
This file contains hidden or 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
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.
Summary
Composite tuple
whereconditions with empty value lists generated an empty SQL grouping. PostgreSQL and MySQL reject the resultingWHERE ()clause.This change emits
1=0through an emptyInpredicate. The relation matches no rows and does not send a database query.Approach
grouping_queries, beside the existing one-query and many-query cases.Inpredicate with the first relevant attribute, so Active Record identifies the relation as a contradiction.Upstream status
The
rails/railsmain branch at216b59017fd1has no equivalent fix. This patch is small and suitable for an upstream submission.Test plan
cd activerecord && bin/test test/cases/relation/where_test.rb test/cases/relation/predicate_builder_test.rbbundle exec rubocop activerecord/lib/active_record/relation/predicate_builder.rb activerecord/test/cases/relation/where_test.rbgit diff --checkCo-authored-by: GPT-5.6-sol noreply@openai.com
Orchestrated-by: ae noreply@shopify.com