You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using multiple piped where's and if these don't contain any "and" in them, the final query ignores the "and's" that should be between the where's and therefore its parentheses, leading to a wrong query that seems good.
Eg.:
User
|> where([u], not is_nil(u.inserted_at) or u.inserted_at <= ^DateTime.utc_now())
|> where([u], is_nil(u.inserted_at) or u.inserted_at > ^DateTime.utc(now())
This query should return 0 results, but it will return all existing users.
But if you add an and to a where, like the following, it will work well:
User
|> where([u], (not is_nil(u.inserted_at) or u.inserted_at <= ^DateTime.utc_now()) and not(is_nil(u.id)))
|> where([u], is_nil(u.inserted_at) or u.inserted_at > ^DateTime.utc(now())
The text was updated successfully, but these errors were encountered:
When using multiple piped where's and if these don't contain any "and" in them, the final query ignores the "and's" that should be between the where's and therefore its parentheses, leading to a wrong query that seems good.
Eg.:
This query should return 0 results, but it will return all existing users.
But if you add an and to a where, like the following, it will work well:
The text was updated successfully, but these errors were encountered: