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
Description:
We've discovered an issue with Pony ORM where the 'in' operator doesn't correctly handle None values in certain queries. Specifically, when querying for a status field that can be either an empty string, None, or a specific value, the query fails to return records where the status is None.
Steps to reproduce:
Create a database with a table that has a nullable status field.
Insert a record with status set to None.
Run the following query:
Tasks.select(lambda t: t.status in ('', None, 'main')).count()
Expected behavior:
The query should return records where status is an empty string, None, or 'main'.
Actual behavior:
The query doesn't return records where status is None.
Workaround:
The issue can be worked around by expanding the condition:
Tasks.select(lambda t: t.status == '' or t.status == None or t.status == 'main').count()
This query correctly returns records with None status.
Environment:
Pony ORM version: 0.7.19
Python version: 3.10.11
Database backend: PostgreSQL
Operating System: Ubuntu Server 22.04
Additional notes:
This behavior is inconsistent with Python's standard 'in' operator, where None in (None, '', 'main') returns True.
The text was updated successfully, but these errors were encountered:
Description:
We've discovered an issue with Pony ORM where the 'in' operator doesn't correctly handle None values in certain queries. Specifically, when querying for a status field that can be either an empty string, None, or a specific value, the query fails to return records where the status is None.
Steps to reproduce:
Create a database with a table that has a nullable status field.
Insert a record with status set to None.
Run the following query:
Tasks.select(lambda t: t.status in ('', None, 'main')).count()
Expected behavior:
The query should return records where status is an empty string, None, or 'main'.
Actual behavior:
The query doesn't return records where status is None.
Workaround:
The issue can be worked around by expanding the condition:
Tasks.select(lambda t: t.status == '' or t.status == None or t.status == 'main').count()
This query correctly returns records with None status.
Environment:
Additional notes:
This behavior is inconsistent with Python's standard 'in' operator, where
None in (None, '', 'main')
returns True.The text was updated successfully, but these errors were encountered: