@@ -322,7 +322,6 @@ PartRelationInfo *
322322get_pathman_relation_info (Oid relid )
323323{
324324PartStatusInfo * psin ;
325- bool refresh ;
326325
327326/* Should always be called in transaction */
328327Assert (IsTransactionState ());
@@ -331,24 +330,18 @@ get_pathman_relation_info(Oid relid)
331330if (relid < FirstNormalObjectId )
332331return NULL ;
333332
334- /*Create a new entry for thistable if needed */
333+ /*Do we know anything about thisrelation? */
335334psin = pathman_cache_search_relid (status_cache ,
336335relid ,HASH_FIND ,
337336NULL );
338337
339- /* Should we build a new PartRelationInfo? */
340- refresh = psin ?
341- (psin -> prel &&
342- !PrelIsFresh (psin -> prel )&&
343- PrelReferenceCount (psin -> prel )== 0 ) :
344- true;
345-
346- if (refresh )
338+ if (!psin )
347339{
348340PartRelationInfo * prel = NULL ;
349341ItemPointerData iptr ;
350342Datum values [Natts_pathman_config ];
351343bool isnull [Natts_pathman_config ];
344+ bool found ;
352345
353346/* Check if PATHMAN_CONFIG table contains this relation */
354347if (pathman_config_contains_relation (relid ,values ,isnull ,NULL ,& iptr ))
@@ -364,21 +357,19 @@ get_pathman_relation_info(Oid relid)
364357prel = build_pathman_relation_info (relid ,values );
365358}
366359
367- /* Create a new entry for this table if needed */
368- if (!psin )
369- {
370- bool found ;
371-
372- psin = pathman_cache_search_relid (status_cache ,
373- relid ,HASH_ENTER ,
374- & found );
375- Assert (!found );
376- }
360+ /* Create a new entry for this relation */
361+ psin = pathman_cache_search_relid (status_cache ,
362+ relid ,HASH_ENTER ,
363+ & found );
364+ Assert (!found );/* it shouldn't just appear out of thin air */
377365
378366/* Cache fresh entry */
379367psin -> prel = prel ;
380368}
381369
370+ /* Check invariants */
371+ Assert (!psin -> prel || PrelIsFresh (psin -> prel ));
372+
382373#ifdef USE_RELINFO_LOGGING
383374elog (DEBUG2 ,
384375"fetching %s record for parent %u [%u]" ,