-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expose err attached to ResultReader #55
Conversation
This is another change meant to support the fix for jackc/pgx#841
This patch fixes jackc#841. To fix it we notice when a statement failed because its cached plan is now invalid and flush it from our cache. We don't try to get fancy with retries or anything like that, just return the error and allow the application to handle it. The flushing of statements is deferred to the end of transactions because all statements executed after an error in a transaction will just result in errors. If we are not in a transaction, we flush eagerly. I had to make [some][1] [changes][2] to to the jackc/pgconn package as well as this package, so I've retargeted this this repo on ethanpailes/pgconn for the time being. This PR is not really in a mergable state until those PRs merge and I rip out 2f31e98, but I would say it is ready for review (just review the most recent commit). One question I have is whether anything else needs to be done around batch SQL, so guidance there would be appreciated. Fixes jackc#841 [1]: jackc/pgconn#54 [2]: jackc/pgconn#55
Closing in favor of #56 |
Nevermind, I actually still need this guy. Reopening. |
This patch fixes jackc#841. The meat of the fix lives in [a PR to the pgconn repo][1]. This change just checks for errors after executing a prepared statement and informs the underlying stmtcache about them so that it can properly clean up. We don't try to get fancy with retries or anything like that, just return the error and allow the application to handle it. I had to make [some][1] [changes][2] to to the jackc/pgconn package as well as this package, so I've retargeted this this repo on ethanpailes/pgconn for the time being. This PR is not really in a mergable state until those PRs merge and I rip out the retargeting commit, but I would say it is ready for review (just review the most recent commit). Fixes jackc#841 [1]: jackc/pgconn#56 [2]: jackc/pgconn#55
If reasonably possible, I'd like to avoid this. I suppose I haven't documented it very well but there is an implicit requirement that nothing should be called on a |
This patch fixes jackc#841. The meat of the fix lives in [a PR to the pgconn repo][1]. This change just checks for errors after executing a prepared statement and informs the underlying stmtcache about them so that it can properly clean up. We don't try to get fancy with retries or anything like that, just return the error and allow the application to handle it. I had to make [some][1] [changes][2] to to the jackc/pgconn package as well as this package, so I've retargeted this this repo on ethanpailes/pgconn for the time being. This PR is not really in a mergable state until those PRs merge and I rip out the retargeting commit, but I would say it is ready for review (just review the most recent commit). Fixes jackc#841 [1]: jackc/pgconn#56 [2]: jackc/pgconn#55
Closing, we didn't end up needing it |
We actually need this change to allow access to the last At the moment, jackc/pgx#870 and #58 cover our required changes to get around this problem, though I'd be open to any other suggestions |
@eh-steve have you tried checking |
This patch fixes jackc#841. The meat of the fix lives in [a PR to the pgconn repo][1]. This change just checks for errors after executing a prepared statement and informs the underlying stmtcache about them so that it can properly clean up. We don't try to get fancy with retries or anything like that, just return the error and allow the application to handle it. I had to make [some][1] [changes][2] to to the jackc/pgconn package as well as this package. Fixes jackc#841 [1]: jackc/pgconn#56 [2]: jackc/pgconn#55
This patch fixes jackc#841. The meat of the fix lives in [a PR to the pgconn repo][1]. This change just checks for errors after executing a prepared statement and informs the underlying stmtcache about them so that it can properly clean up. We don't try to get fancy with retries or anything like that, just return the error and allow the application to handle it. I had to make [some][1] [changes][2] to to the jackc/pgconn package as well as this package. Fixes jackc#841 [1]: jackc/pgconn#56 [2]: jackc/pgconn#55
Yeah, that works in jackc/pgx#865 but not before that. I'm happy to close both my PRs as soon as jackc/pgx#865 is merged as it addresses my problem |
(By the way, it might be an idea to use the |
I suspect that jackc is going to want to merge jackc/pgx#865 because he has expressed reservations about exposing the error from the result reader due to concerns about use-after-free (well not really because go has a GC, but it sounds like the allocation is cached and re-used).
Yeah, jackc pointed that out to me as well. I didn't know about the technique before. |
This is another change meant to support the fix for jackc/pgx#841