@@ -699,13 +699,13 @@ DECLARE
699
699
v_part_nameTEXT ;
700
700
v_intervalTEXT ;
701
701
BEGIN
702
+ /* Prevent concurrent partition creation*/
703
+ PERFORM @extschema@.acquire_partitions_lock();
704
+
702
705
SELECT attname, range_interval INTO v_attname, v_interval
703
706
FROM @extschema@.pathman_configWHERE relname::regclass= p_relation;
704
707
705
708
v_atttype := @extschema@.get_attribute_type_name(p_relation, v_attname);
706
-
707
- /* Prevent concurrent partition creation*/
708
- PERFORM @extschema@.acquire_partitions_lock();
709
709
710
710
EXECUTE format(' SELECT @extschema@.append_partition_internal($1, $2, $3, ARRAY[]::%s[])' , v_atttype)
711
711
INTO v_part_name
@@ -721,8 +721,8 @@ BEGIN
721
721
RETURN v_part_name;
722
722
723
723
EXCEPTION WHEN others THEN
724
- PERFORM @extschema@.release_partitions_lock();
725
724
RAISE EXCEPTION' % %' , SQLERRM, SQLSTATE;
725
+ PERFORM @extschema@.release_partitions_lock();
726
726
END
727
727
$$
728
728
LANGUAGE plpgsql;
@@ -768,13 +768,13 @@ DECLARE
768
768
v_part_nameTEXT ;
769
769
v_intervalTEXT ;
770
770
BEGIN
771
+ /* Prevent concurrent partition creation*/
772
+ PERFORM @extschema@.acquire_partitions_lock();
773
+
771
774
SELECT attname, range_interval INTO v_attname, v_interval
772
775
FROM @extschema@.pathman_configWHERE relname::regclass= p_relation;
773
776
v_atttype := @extschema@.get_attribute_type_name(p_relation, v_attname);
774
777
775
- /* Prevent concurrent partition creation*/
776
- PERFORM @extschema@.acquire_partitions_lock();
777
-
778
778
EXECUTE format(' SELECT @extschema@.prepend_partition_internal($1, $2, $3, ARRAY[]::%s[])' , v_atttype)
779
779
INTO v_part_name
780
780
USING p_relation, v_atttype, v_interval;
@@ -789,8 +789,8 @@ BEGIN
789
789
RETURN v_part_name;
790
790
791
791
EXCEPTION WHEN others THEN
792
- PERFORM @extschema@.release_partitions_lock();
793
792
RAISE EXCEPTION' % %' , SQLERRM, SQLSTATE;
793
+ PERFORM @extschema@.release_partitions_lock();
794
794
END
795
795
$$
796
796
LANGUAGE plpgsql;