query to match if boolean field is not True

31 views
Skip to first unread message

David Zejda

unread,
Feb 6, 2018, 6:32:44 PM2/6/18
to web2py-users
Hi :)

Intuitively I would expect that these queries are equivalent ways to match if boolean_field is not True:

~(db.mytable.boolean_field == True)

(db.mytable.boolean_field != True)

((db.mytable.boolean_field == None) | (db.mytable.boolean_field == False))

But only the last one works as expected.

David

Massimo Di Pierro

unread,
Feb 10, 2018, 11:52:44 PM2/10/18
to web2py-users
I would expect that too but it is not a web2py issue. It is a database issue. web2py simply translate those in

NOT mytable.boolean_field = 'T'

David Zejda

unread,
Feb 12, 2018, 2:06:00 PM2/12/18
to web2py-users

On Sunday, 11 February 2018 05:52:44 UTC+1, Massimo Di Pierro wrote:
I would expect that too but it is not a web2py issue. It is a database issue. web2py simply translate those in

Hi Massimo, thank you for explanation!

David
Reply all
Reply to author
Forward
0 new messages