aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/tcop/postgres.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 899723470d6..174c72a14bc 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -4269,7 +4269,18 @@ PostgresMain(int argc, char *argv[],
firstchar = ReadCommand(&input_message);
/*
- * (4) disable async signal conditions again.
+ * (4) turn off the idle-in-transaction timeout, if active. We do
+ * this before step (5) so that any last-moment timeout is certain to
+ * be detected in step (5).
+ */
+ if (disable_idle_in_transaction_timeout)
+ {
+ disable_timeout(IDLE_IN_TRANSACTION_SESSION_TIMEOUT, false);
+ disable_idle_in_transaction_timeout = false;
+ }
+
+ /*
+ * (5) disable async signal conditions again.
*
* Query cancel is supposed to be a no-op when there is no query in
* progress, so if a query cancel arrived while we were idle, just
@@ -4281,15 +4292,6 @@ PostgresMain(int argc, char *argv[],
DoingCommandRead = false;
/*
- * (5) turn off the idle-in-transaction timeout
- */
- if (disable_idle_in_transaction_timeout)
- {
- disable_timeout(IDLE_IN_TRANSACTION_SESSION_TIMEOUT, false);
- disable_idle_in_transaction_timeout = false;
- }
-
- /*
* (6) check for any other interesting events that happened while we
* slept.
*/