diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-03-30 21:58:11 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-03-30 21:58:11 +0000 |
commit | d174a4adbb7423ee5ff30aa98043db4521ffd1be (patch) | |
tree | ddbcea5d50df5337bcfc6c5969232b2e492a71de /src/backend/optimizer/util/plancat.c | |
parent | 2a77355ea1e53bc234ed0b5fda8ec9f304f6797a (diff) | |
download | postgresql-d174a4adbb7423ee5ff30aa98043db4521ffd1be.tar.gz postgresql-d174a4adbb7423ee5ff30aa98043db4521ffd1be.zip |
Fix "constraint_exclusion = partition" logic so that it will also attempt
constraint exclusion on an inheritance set that is the target of an UPDATE
or DELETE query. Per gripe from Marc Cousin. Back-patch to 8.4 where
the feature was introduced.
Diffstat (limited to 'src/backend/optimizer/util/plancat.c')
-rw-r--r-- | src/backend/optimizer/util/plancat.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index fdce5bb5a3f..10800b488f6 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.162 2010/01/05 21:53:58 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.163 2010/03/30 21:58:10 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -580,7 +580,10 @@ relation_excluded_by_constraints(PlannerInfo *root, /* Skip the test if constraint exclusion is disabled for the rel */ if (constraint_exclusion == CONSTRAINT_EXCLUSION_OFF || (constraint_exclusion == CONSTRAINT_EXCLUSION_PARTITION && - rel->reloptkind != RELOPT_OTHER_MEMBER_REL)) + !(rel->reloptkind == RELOPT_OTHER_MEMBER_REL || + (root->hasInheritedTarget && + rel->reloptkind == RELOPT_BASEREL && + rel->relid == root->parse->resultRelation)))) return false; /* |