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

Check for null in where clauses #23

Merged
merged 17 commits into from May 20, 2022
Merged

Check for null in where clauses #23

merged 17 commits into from May 20, 2022

Conversation

danvk
Copy link
Owner

@danvk danvk commented May 20, 2022

If the where clause of a query contains a null value, or is a set containing a null value, then we replace:

  • WHERE column = $1WHERE (column IS NULL OR column = $1)
  • WHERE column = ANY($1)WHERE (column IS NULL OR column = ANY($1))

Especially in the former case this is a little roundabout since the column = $1 clause can never match. But this does have the advantage that we don't need to renumber all the remaining fields.

Fixes #22

@danvk danvk merged commit e8a4923 into main May 20, 2022
@danvk danvk deleted the nullable-filter branch May 20, 2022 14:14
src/index.ts Show resolved Hide resolved
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.

Issue with queries for null
2 participants