added support for select queries without patterns