I was able to bypass this error by setting my own limit on the query. This worked for me because I had full control over the sql statement. By specifying the limit myself it did not rely on the 'default'. I also made sure to end the query with a ';' but not sure if that made any difference.