Fix stack overflow in IdoPgsqlConnection::InternalExecuteQuery.

Fixes #5610