From 96aa2fa7eb0554483dd960cd6e8964bbf07521b9 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 24 Jan 2018 13:02:38 -0300 Subject: [PATCH v2 5/5] don't error creating constraint triggers if internal --- src/backend/commands/trigger.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 7cb709ea26..71a1fbeca5 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -238,9 +238,13 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, errdetail("Partitioned tables cannot have BEFORE / FOR EACH ROW triggers."))); /* - * Constraint triggers are not allowed, either. + * Constraint triggers are not allowed, either, except those + * created internally. (This distinction is important because + * internally-created triggers are expected to recurse creation + * by themselves, while regular ones would have to be recursed + * here, and that's not implemented yet.) */ - if (stmt->isconstraint) + if (stmt->isconstraint && !isInternal) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("\"%s\" is a partitioned table", -- 2.11.0