In the BaseAdapter._select method at https://github.com/web2py/web2py/blob/master/gluon/dal/adapters/base.py#L1035, it looks like tables included only by virtue of the list of fields in ._select() but not explicitly included in the query are purposely left out of the common_filters fitlering (i.e., the tablenames_for_common_filters variable is defined before looping through the fields to add extra tables to the list of tablenames). I'm not sure why it was done this way, as I would think you would want the common filter to apply whenever a query involves the table in question. If it's not a bug, it may at least be a design choice worth revisiting.
Anthony On Friday, October 31, 2014 1:40:44 PM UTC-4, mcamel wrote: > > Hi everybody, > > It seems common filters do nothing is there is no WHERE clause in the SQL. > > Following book example: > > db.blog_post.insert(subject='one', post_text=request.utcnow, is_public > =True) > db.blog_post.insert(subject='two', post_text=request.utcnow, is_public > =False) > > this gives no WHERE clause: > > db()._select(db.blog_post.ALL, limitby=(0,5)) > > while this: > > db(db.blog_post)._select(db.blog_post.ALL, limitby=(0,5)) > > gives this the expected clause: > > ... WHERE ((blog_post.id IS NOT NULL) AND (blog_post.is_public = 'T')) > ... > > > Is this intentionally or is it a bug?. > > Thanks! > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.