Closed evanj closed 1 year ago
👍
Sorry for the massive delay. I must have lost the github notification on the PR. I have merged the latest master, and have fixed the code review comment above. Thanks!
@rafiss can your request for changes be removed now that @evanj addressed your concerns?
@evanj thanks for the fix, we ran into the same issue recently
Commit 8446d16b89 released in 1.10.4 changed how some cancelled query errors were returned. This has caused a lib/pq application I work on to start returning "driver: bad connection". This is because we were cancelling a query, after looking at some of the rows. This causes a "bad" connection to be returned to the connection pool.
To prevent this, implement the driver.Validator and driver.SessionResetter interfaces. The database/sql/driver package recommends implementing them:
"All Conn implementations should implement the following interfaces: Pinger, SessionResetter, and Validator"
Add two tests for this behaviour. One of these tests passed with 1.10.3 but fails with newer versions. The other never passed, but does after this change.