@@ -693,14 +693,14 @@ DECLARE
693
693
v_part_nameTEXT ;
694
694
v_intervalTEXT ;
695
695
BEGIN
696
+ /* Prevent concurrent partition creation*/
697
+ PERFORM @extschema@.acquire_partitions_lock();
698
+
696
699
SELECT attname, range_interval INTO v_attname, v_interval
697
700
FROM @extschema@.pathman_configWHERE relname::regclass= p_relation;
698
701
699
702
v_atttype := @extschema@.get_attribute_type_name(p_relation, v_attname);
700
703
701
- /* Prevent concurrent partition creation*/
702
- PERFORM @extschema@.acquire_partitions_lock();
703
-
704
704
EXECUTE format(' SELECT @extschema@.append_partition_internal($1, $2, $3, ARRAY[]::%s[])' , v_atttype)
705
705
INTO v_part_name
706
706
USING p_relation, v_atttype, v_interval;
@@ -715,8 +715,8 @@ BEGIN
715
715
RETURN v_part_name;
716
716
717
717
EXCEPTION WHEN others THEN
718
- PERFORM @extschema@.release_partitions_lock();
719
718
RAISE EXCEPTION' % %' , SQLERRM, SQLSTATE;
719
+ PERFORM @extschema@.release_partitions_lock();
720
720
END
721
721
$$
722
722
LANGUAGE plpgsql;
@@ -762,13 +762,13 @@ DECLARE
762
762
v_part_nameTEXT ;
763
763
v_intervalTEXT ;
764
764
BEGIN
765
+ /* Prevent concurrent partition creation*/
766
+ PERFORM @extschema@.acquire_partitions_lock();
767
+
765
768
SELECT attname, range_interval INTO v_attname, v_interval
766
769
FROM @extschema@.pathman_configWHERE relname::regclass= p_relation;
767
770
v_atttype := @extschema@.get_attribute_type_name(p_relation, v_attname);
768
771
769
- /* Prevent concurrent partition creation*/
770
- PERFORM @extschema@.acquire_partitions_lock();
771
-
772
772
EXECUTE format(' SELECT @extschema@.prepend_partition_internal($1, $2, $3, ARRAY[]::%s[])' , v_atttype)
773
773
INTO v_part_name
774
774
USING p_relation, v_atttype, v_interval;
@@ -783,8 +783,8 @@ BEGIN
783
783
RETURN v_part_name;
784
784
785
785
EXCEPTION WHEN others THEN
786
- PERFORM @extschema@.release_partitions_lock();
787
786
RAISE EXCEPTION' % %' , SQLERRM, SQLSTATE;
787
+ PERFORM @extschema@.release_partitions_lock();
788
788
END
789
789
$$
790
790
LANGUAGE plpgsql;