@@ -725,6 +725,9 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
725725 else ereport (ERROR , (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
726726 errmsg ("'parent_relid' should not be NULL" )));
727727
728+ /* Lock relation */
729+ xact_lock_rel_exclusive (relid , true);
730+
728731 /* Check that relation exists */
729732 if (!SearchSysCacheExists1 (RELOID , ObjectIdGetDatum (relid )))
730733 ereport (ERROR , (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
@@ -792,11 +795,11 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
792795 /*
793796 * Initialize columns (partrel, attname, parttype, range_interval).
794797 */
795- values [Anum_pathman_config_partrel - 1 ] = ObjectIdGetDatum (relid );
796- isnull [Anum_pathman_config_partrel - 1 ] = false;
798+ values [Anum_pathman_config_partrel - 1 ] = ObjectIdGetDatum (relid );
799+ isnull [Anum_pathman_config_partrel - 1 ] = false;
797800
798- values [Anum_pathman_config_parttype - 1 ] = Int32GetDatum (parttype );
799- isnull [Anum_pathman_config_parttype - 1 ] = false;
801+ values [Anum_pathman_config_parttype - 1 ] = Int32GetDatum (parttype );
802+ isnull [Anum_pathman_config_parttype - 1 ] = false;
800803
801804 values [Anum_pathman_config_expr - 1 ] = CStringGetTextDatum (expression );
802805 isnull [Anum_pathman_config_expr - 1 ] = false;
0 commit comments