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

[4.x]: "Not in" queries returning incorrect results for columns that have null values. #11931

Closed
nfourtythree opened this issue Sep 13, 2022 · 2 comments · Fixed by #12083
Closed
Assignees

Comments

@nfourtythree
Copy link
Contributor

What happened?

Description

When create queries that use syntax along the lines of ['not', 'a', 'b', 'c'] the Db helper method parseParam() refines this to the following SQL (based on the column name of myColumn)

WHERE (NOT (`table_name`.`myColumn` IN ('a', 'b', 'c')))

With the data below you would expect IDs 4, 5 and 6 returned but only 4 and 5 are.

ID myColumn
1 'a'
2 'b'
3 'c'
4 'd'
5 ''
6 null

Expected behavior

null values are returned when using "Not in"

Craft CMS version

4.x

PHP version

8.0

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

@brandonkelly brandonkelly self-assigned this Sep 13, 2022
brandonkelly added a commit that referenced this issue Oct 2, 2022
@brandonkelly
Copy link
Member

Fixed for Craft 4.3 via ce1b6de 🎉

@brandonkelly
Copy link
Member

That fix was reverted in Craft 4.3.4 due to performance issues.

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

Successfully merging a pull request may close this issue.

2 participants