aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index b46b0551f94..36cc99ec9cf 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -4111,12 +4111,12 @@ PostgresSingleUserMain(int argc, char *argv[],
void
PostgresMain(const char *dbname, const char *username)
{
- int firstchar;
- StringInfoData input_message;
sigjmp_buf local_sigjmp_buf;
+
+ /* these must be volatile to ensure state is preserved across longjmp: */
volatile bool send_ready_for_query = true;
- bool idle_in_transaction_timeout_enabled = false;
- bool idle_session_timeout_enabled = false;
+ volatile bool idle_in_transaction_timeout_enabled = false;
+ volatile bool idle_session_timeout_enabled = false;
Assert(dbname != NULL);
Assert(username != NULL);
@@ -4322,8 +4322,10 @@ PostgresMain(const char *dbname, const char *username)
* query cancels from being misreported as timeouts in case we're
* forgetting a timeout cancel.
*/
- disable_all_timeouts(false);
- QueryCancelPending = false; /* second to avoid race condition */
+ disable_all_timeouts(false); /* do first to avoid race condition */
+ QueryCancelPending = false;
+ idle_in_transaction_timeout_enabled = false;
+ idle_session_timeout_enabled = false;
/* Not reading from the client anymore. */
DoingCommandRead = false;
@@ -4418,6 +4420,9 @@ PostgresMain(const char *dbname, const char *username)
for (;;)
{
+ int firstchar;
+ StringInfoData input_message;
+
/*
* At top of loop, reset extended-query-message flag, so that any
* errors encountered in "idle" state don't provoke skip.