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, 16 insertions, 1 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 407c548cf8f..587d065f1cc 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -2883,7 +2883,22 @@ ProcessInterrupts(void)
(errcode(ERRCODE_QUERY_CANCELED),
errmsg("canceling authentication due to timeout")));
}
- if (get_timeout_indicator(STATEMENT_TIMEOUT))
+
+ /*
+ * If LOCK_TIMEOUT and STATEMENT_TIMEOUT indicators are both set, we
+ * prefer to report the former; but be sure to clear both.
+ */
+ if (get_timeout_indicator(LOCK_TIMEOUT, true))
+ {
+ ImmediateInterruptOK = false; /* not idle anymore */
+ (void) get_timeout_indicator(STATEMENT_TIMEOUT, true);
+ DisableNotifyInterrupt();
+ DisableCatchupInterrupt();
+ ereport(ERROR,
+ (errcode(ERRCODE_QUERY_CANCELED),
+ errmsg("canceling statement due to lock timeout")));
+ }
+ if (get_timeout_indicator(STATEMENT_TIMEOUT, true))
{
ImmediateInterruptOK = false; /* not idle anymore */
DisableNotifyInterrupt();