1515
1616#include "access/htup_details.h"
1717#include "access/xact.h"
18+ #include "catalog/catalog.h"
1819#include "catalog/indexing.h"
1920#include "catalog/pg_inherits.h"
2021#include "miscadmin.h"
@@ -242,12 +243,11 @@ get_pathman_relation_info(Oid relid)
242243 part_type = DatumGetPartType (values [Anum_pathman_config_parttype - 1 ]);
243244 attname = TextDatumGetCString (values [Anum_pathman_config_attname - 1 ]);
244245
245- /* Refresh partitioned table cache entry */
246+ /* Refresh partitioned table cache entry (might turn NULL) */
246247 /* TODO: possible refactoring, pass found 'prel' instead of searching */
247248 prel = refresh_pathman_relation_info (relid ,
248249 part_type ,
249250 attname );
250- Assert (PrelIsValid (prel )); /* it MUST be valid if we got here */
251251 }
252252 /* Else clear remaining cache entry */
253253 else remove_pathman_relation_info (relid );
@@ -346,7 +346,7 @@ finish_delayed_invalidation(void)
346346 /* Handle the probable 'DROP EXTENSION' case */
347347 if (delayed_shutdown )
348348 {
349- Oid cur_pathman_config_relid ;
349+ Oid cur_pathman_config_relid ;
350350
351351 /* Unset 'shutdown' flag */
352352 delayed_shutdown = false;
@@ -376,9 +376,14 @@ finish_delayed_invalidation(void)
376376 {
377377 Oid parent = lfirst_oid (lc );
378378
379+ /* Skip if it's a TOAST table */
380+ if (IsToastNamespace (get_rel_namespace (parent )))
381+ continue ;
382+
379383 if (!pathman_config_contains_relation (parent , NULL , NULL , NULL ))
380384 remove_pathman_relation_info (parent );
381385 else
386+ /* get_pathman_relation_info() will refresh this entry */
382387 invalidate_pathman_relation_info (parent , NULL );
383388 }
384389
@@ -387,6 +392,10 @@ finish_delayed_invalidation(void)
387392 {
388393 Oid vague_rel = lfirst_oid (lc );
389394
395+ /* Skip if it's a TOAST table */
396+ if (IsToastNamespace (get_rel_namespace (vague_rel )))
397+ continue ;
398+
390399 /* It might be a partitioned table or a partition */
391400 if (!try_perform_parent_refresh (vague_rel ))
392401 {
@@ -656,7 +665,7 @@ shout_if_prel_is_invalid(Oid parent_oid,
656665 PartType expected_part_type )
657666{
658667 if (!prel )
659- elog (ERROR , "relation \"%s\" is not partitioned by pg_pathman " ,
668+ elog (ERROR , "relation \"%s\" has no partitions " ,
660669 get_rel_name_or_relid (parent_oid ));
661670
662671 if (!PrelIsValid (prel ))
0 commit comments