[FOLLOWUP][BUGFIX] Add query restrictions for all tables in query