Background : I'm using postgres (web2py 2.9.5 - but I don't think it matters) I have an integer field - which is optional say "Number of pets" I have NOT set any default value (I think for Postgres - this means default NULL)
When user does not select from the drop down IS_EMPTY_OR(IS_IN_SET([1,2,3,4])) - I see value "None" in the grid (Seems OK) I have *another grid* where I need to find people with "1" pet - I *also* need to *count* people who have *not specified* the count. So (part of) my query is : db.user_profile.pets.belongs([1, None]) But this returns only the profiles with number of pet as "1" i.e. Profiles where number of pets is NOT specified isn't returned. I checked db._lastsql - it turns out it is Postgres that doesn't return the rows (So it is not really web2py's fault) The "raw" query is : SELECT * FROM user_profile WHERE user_profile.pets IN (1,NULL); I also tried : ~db.user_profile.pets.belongs([2,3,4]) Assuming "None" isn't part of 2,3,4 - so those rows will be returned - but only the rows with pets=1 are returned. Queries : 1. What is the default value at Postgres level ? (*psql command prompt shows white space under pets column for those records*) 2. What DAL query should I use to get *both* "pets specified as 1" and "pets count not specified" ? Thanks, -Mandar P.S: I'm not sure subject makes sense or matches with my question, but I didn't know how to "summarize" my query in the subject -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

