*** pgsql/src/backend/optimizer/prep/prepunion.c 2009/03/05 17:30:29 1.167 --- pgsql/src/backend/optimizer/prep/prepunion.c 2009/03/31 22:12:48 1.168 *************** *** 22,28 **** * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.166 2009/02/25 03:30:37 tgl Exp $ * *------------------------------------------------------------------------- */ --- 22,28 ---- * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.167 2009/03/05 17:30:29 tgl Exp $ * *------------------------------------------------------------------------- */ *************** expand_inherited_rtentry(PlannerInfo *ro *** 1258,1278 **** Index childRTindex; AppendRelInfo *appinfo; /* * 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))) 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. --- 1258,1280 ---- 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 && RELATION_IS_OTHER_TEMP(newrelation)) ! { ! heap_close(newrelation, lockmode); continue; ! } /* * Build an RTE for the child, and attach to query's rangetable list.