@@ -285,7 +285,7 @@ show_partition_list_internal(PG_FUNCTION_ARGS)
285285 usercxt = (show_partition_list_cxt * ) palloc (sizeof (show_partition_list_cxt ));
286286
287287 /* Open PATHMAN_CONFIG with latest snapshot available */
288- usercxt -> pathman_config = heap_open (get_pathman_config_relid (),
288+ usercxt -> pathman_config = heap_open (get_pathman_config_relid (false ),
289289 AccessShareLock );
290290 usercxt -> snapshot = RegisterSnapshot (GetLatestSnapshot ());
291291 usercxt -> pathman_config_scan = heap_beginscan (usercxt -> pathman_config ,
@@ -637,7 +637,7 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
637637 isnull [Anum_pathman_config_range_interval - 1 ] = PG_ARGISNULL (2 );
638638
639639 /* Insert new row into PATHMAN_CONFIG */
640- pathman_config = heap_open (get_pathman_config_relid (), RowExclusiveLock );
640+ pathman_config = heap_open (get_pathman_config_relid (false ), RowExclusiveLock );
641641 htup = heap_form_tuple (RelationGetDescr (pathman_config ), values , isnull );
642642 simple_heap_insert (pathman_config , htup );
643643 indstate = CatalogOpenIndexes (pathman_config );
@@ -685,11 +685,18 @@ Datum
685685pathman_config_params_trigger_func (PG_FUNCTION_ARGS )
686686{
687687 TriggerData * trigdata = (TriggerData * ) fcinfo -> context ;
688- Oid pathman_config_params = get_pathman_config_params_relid () ;
688+ Oid pathman_config_params ;
689689 Oid partrel ;
690690 Datum partrel_datum ;
691691 bool partrel_isnull ;
692692
693+ /* Fetch Oid of PATHMAN_CONFIG_PARAMS */
694+ pathman_config_params = get_pathman_config_params_relid (true);
695+
696+ /* Handle "pg_pathman.enabled = t" case */
697+ if (!OidIsValid (pathman_config_params ))
698+ goto pathman_config_params_trigger_func_return ;
699+
693700 /* Handle user calls */
694701 if (!CALLED_AS_TRIGGER (fcinfo ))
695702 elog (ERROR , "this function should not be called directly" );
@@ -718,6 +725,7 @@ pathman_config_params_trigger_func(PG_FUNCTION_ARGS)
718725 if (check_relation_exists (partrel ))
719726 CacheInvalidateRelcacheByRelid (partrel );
720727
728+ pathman_config_params_trigger_func_return :
721729 /* Return the tuple we've been given */
722730 if (trigdata -> tg_event & TRIGGER_EVENT_UPDATE )
723731 PG_RETURN_POINTER (trigdata -> tg_newtuple );
0 commit comments