[go: up one dir, main page]

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

Record.where.not(field: array) does not return entries with nil field when array does not include nil #53736

Open
pedrorolo opened this issue Nov 25, 2024 · 1 comment

Comments

@pedrorolo
Copy link
Record.where.not(field: ["a","b"]).to_sql
=> "SELECT \"records\".* FROM \"records\" WHERE  \"records\".\"field\" NOT IN ('a', 'b')"

Should eventually have the following semantics when the array does not contain the nil value:

Record.where(field: nil).or(Record.where.not(field: ["a","b"])).to_sql
=> "SELECT \"records\".* FROM \"records\" WHERE (\"records\".\"field\" IS NULL OR \"records\".\"field\" NOT IN ('a', 'b'))"
@pedrorolo
Copy link
Author

I realize this is related to ANSI NULLS. However, arguably #where should be agnostic to this setting.

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

No branches or pull requests

1 participant