aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2019-11-07 13:59:24 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2019-11-07 13:59:24 -0300
commitb75ccddcd6f747dc386411eeac6bbfdface14a2c (patch)
tree84b3e5e6705e81cede2aafd681fe1f44ab02df42 /src/backend
parentf6e72dc9cc8b8f480ea4a982662c3695ddc5a549 (diff)
downloadpostgresql-b75ccddcd6f747dc386411eeac6bbfdface14a2c.tar.gz
postgresql-b75ccddcd6f747dc386411eeac6bbfdface14a2c.zip
Fix SET CONSTRAINTS .. DEFERRED on partitioned tables
SET CONSTRAINTS ... DEFERRED failed on partitioned tables, because of a sanity check that ensures that the affected constraints have triggers. On partitioned tables, the triggers are in the leaf partitions, not in the partitioned relations themselves, so the sanity check fails. Removing the sanity check solves the problem, because the code needed to support the case is already there. Backpatch to 11. Note: deferred unique constraints are not affected by this bug, because they do have triggers in the parent partitioned table. I did not add a test for this scenario. Discussion: https://postgr.es/m/20191105212915.GA11324@alvherre.pgsql
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/commands/trigger.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 57c98912d58..e2048c19f79 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -5512,13 +5512,10 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt)
foreach(lc, conoidlist)
{
Oid conoid = lfirst_oid(lc);
- bool found;
ScanKeyData skey;
SysScanDesc tgscan;
HeapTuple htup;
- found = false;
-
ScanKeyInit(&skey,
Anum_pg_trigger_tgconstraint,
BTEqualStrategyNumber, F_OIDEQ,
@@ -5539,16 +5536,9 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt)
*/
if (pg_trigger->tgdeferrable)
tgoidlist = lappend_oid(tgoidlist, pg_trigger->oid);
-
- found = true;
}
systable_endscan(tgscan);
-
- /* Safety check: a deferrable constraint should have triggers */
- if (!found)
- elog(ERROR, "no triggers found for constraint with OID %u",
- conoid);
}
table_close(tgrel, AccessShareLock);