This is a discussion we are having on an issue on the pq library:
The problem is, because of the way the postgresql protocol works, it is not possible to issue a new query before reading all data from the previous query.
Because of this, if I do a query using db.Query, and while iterating the rows I issue another query, we get an error from the protocol, because it is expecting that we read the next data row.
The discussion is about fetching all rows on query, or just warn on the documentation that it works this way.
Another option would be to just fetch all data when a new query is issued, but we are not sure about how to handle this issue in connection for thread safety, and if it is a goood ideia do store this kind of state on the connection object.
Reading the database/sql documentation, there is no mention if the driver should support more than 1 query at the same time.
Anyone has any opinion about this issue?
Thanks,
Rangel