aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeModifyTable.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-08-04 14:10:06 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-08-04 14:10:06 -0400
commit963a6b6fa45d8f7627c14be7295f709ef92204f5 (patch)
treef29d6d3989a022a021518180787f21fa9a056702 /src/backend/executor/nodeModifyTable.c
parent9c92a10f5a986d155b92c8375267a630b3322429 (diff)
downloadpostgresql-963a6b6fa45d8f7627c14be7295f709ef92204f5.tar.gz
postgresql-963a6b6fa45d8f7627c14be7295f709ef92204f5.zip
Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop.
Ordinarily the functions called in this loop ought to have plenty of CFIs themselves; but we've now seen a case where no such CFI is reached, making the loop uninterruptible. Even though that's from a recently-introduced bug, it seems prudent to install a CFI at the loop level in all branches. Per discussion of bug #17558 from Andrew Kesper (an actual fix for that bug will follow). Discussion: https://postgr.es/m/17558-3f6599ffcf52fd4a@postgresql.org
Diffstat (limited to 'src/backend/executor/nodeModifyTable.c')
-rw-r--r--src/backend/executor/nodeModifyTable.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index 24b4818d35c..91bd0de28ce 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -516,9 +516,11 @@ ExecInsert(ModifyTableState *mtstate,
*
* We loop back here if we find a conflict below, either during
* the pre-check, or when we re-check after inserting the tuple
- * speculatively.
+ * speculatively. Better allow interrupts in case some bug makes
+ * this an infinite loop.
*/
vlock:
+ CHECK_FOR_INTERRUPTS();
specConflict = false;
if (!ExecCheckIndexConstraints(slot, estate, &conflictTid,
arbiterIndexes))