Fix interbase limit issue for subqueries

Fixes Issue #2138