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

not boolean_column (None) is unexpected #232

luckydonald opened this issue Feb 8, 2017 · 1 comment

not boolean_column (None) is unexpected #232

luckydonald opened this issue Feb 8, 2017 · 1 comment


Copy link

Hey, I'm havin unexpected behaviour with bool:

packs =
        p for p in Pack if not p.nsfw

Results in

SELECT "p"."url", "p"."title", "p"."nsfw", "p"."owner_id", "p"."first_seen", "p"."last_crawled", "p"."sticker_count"
FROM "pack" "p"
WHERE ("p"."nsfw")::int = 0

Which doesn't seem to cover the not None=>True case.

For postgres it could be like this Stackoverflow:

SELECT * FROM table_name WHERE (boolean_column IS NULL OR NOT boolean_column)

Indeed, a python workaround is:

p for p in Pack if p.nsfw is True or p.nsfw is None
@kozlovsky kozlovsky self-assigned this Mar 2, 2017
@kozlovsky kozlovsky added the bug label Mar 2, 2017
@kozlovsky kozlovsky added this to the 0.7.2 milestone Mar 2, 2017
Copy link


kozlovsky added a commit that referenced this issue Jul 17, 2017
# New features

* All arguments of db.bind() can be specified as keyword arguments. Previously Pony required the first positional argument which specified the database provider. Now you can pass all the database parameters using the dict: db.bind(**db_params). See
* The `optimistic` attribute option is added

# Bugfixes

* Fixes #219: when a database driver raises an error, sometimes this error was masked by the 'RollbackException: InterfaceError: connection already closed' exception. This happened because on error, Pony tried to rollback transaction, but the connection to the database was already closed and it masked the initial error. Now Pony displays the original error which helps to understand the cause of the problem.
* Fixes #276: Memory leak
* Fixes the __all__ declaration. Previously IDEs, such as PyCharm, could not understand what is going to be imported by 'from pony.orm import *'. Now it works fine.
* Fixes #232: negate check for numeric expressions now checks if value is zero or NULL
* Fixes #238, fixes #133: raise TransactionIntegrityError exception instead of AssertionError if obj.collection.create(**kwargs) creates a duplicate object
* Fixes #221: issue with unicode json path keys
* Fixes bug when discriminator column is used as a part of a primary key
* Handle situation when SQLite blob column contains non-binary value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants