diff options
Diffstat (limited to 'src/backend/optimizer/prep/prepunion.c')
-rw-r--r-- | src/backend/optimizer/prep/prepunion.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c index 43aa515ae5e..06f920561a2 100644 --- a/src/backend/optimizer/prep/prepunion.c +++ b/src/backend/optimizer/prep/prepunion.c @@ -22,7 +22,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.167 2009/03/05 17:30:29 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.168 2009/03/31 22:12:48 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1258,21 +1258,23 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti) Index childRTindex; AppendRelInfo *appinfo; + /* Open rel, acquire the appropriate lock type */ + if (childOID != parentOID) + newrelation = heap_open(childOID, lockmode); + else + newrelation = oldrelation; + /* * It is possible that the parent table has children that are temp * tables of other backends. We cannot safely access such tables * (because of buffering issues), and the best thing to do seems to be * to silently ignore them. */ - if (childOID != parentOID && - isOtherTempNamespace(get_rel_namespace(childOID))) + if (childOID != parentOID && RELATION_IS_OTHER_TEMP(newrelation)) + { + heap_close(newrelation, lockmode); continue; - - /* Open rel, acquire the appropriate lock type */ - if (childOID != parentOID) - newrelation = heap_open(childOID, lockmode); - else - newrelation = oldrelation; + } /* * Build an RTE for the child, and attach to query's rangetable list. |