Skip to content
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

Simplify the query run to make sure to report the correct error #641

Closed
wants to merge 1 commit into from

Conversation

keiko713
Copy link
Contributor

Currently, if the query is failed to run with some errors other than the timeout (e.g. syntax error), the error won't be correctly reported back and the error becomes "pq: current transaction is aborted, commands ignored until end of transaction block", as the second run's error will be reported.

pgaweb=# BEGIN READ ONLY;
BEGIN
pgaweb=*# select pg_sleep('abc');
ERROR:  invalid input syntax for type double precision: "abc"
LINE 1: select pg_sleep('abc');
                        ^
pgaweb=!# select pg_sleep('abc');
ERROR:  current transaction is aborted, commands ignored until end of transaction block

I updated and simplified a bit to avoid this, but I'm not actually sure if this is what we want. Looks like currently we are not running the query 3 times unless the 1. error 2. success case. Maybe the intention here is that the first run failed due to the timeout, but second run went well because some half-cached data from the first run there? If so, I'm happy to update the logic, but I think we need to narrow down the error checking and try the second run only when the first run failed with the timeout error.

@keiko713 keiko713 requested review from a team and seanlinsley November 26, 2024 10:49
@seanlinsley
Copy link
Member

Maybe the intention here is that the first run failed due to the timeout, but second run went well because some half-cached data from the first run there?

Yes, that's the intention. I put together a different way of fixing this that doesn't change the flow of the code: #642

@keiko713 keiko713 closed this Nov 26, 2024
@keiko713 keiko713 deleted the report-first-error branch November 26, 2024 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants