This fixes #8080.  It was not respecting if a subroutine returned an empty result when building the where clause.