Early termination of the processing of statement client's result set

With a custom SQL query that I have written in Tableau I noticed that the foreach loop in driver.d SQLExecuteImpl function, which traverses the result set of the query, terminates early and prevents the actual result to be returned to the application. The foreach construct calls the statement client's empty(), front(), and popfront() functions in order as expected, but the empty() function returns true before the last result (that contains the actual result of the query) is retrieved & processed with the front() call.