Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0b3ae13

Browse files
committed
pathman: return partitions count
1 parent2f9dbb2 commit0b3ae13

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

‎contrib/pg_pathman/sql/hash.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ CREATE OR REPLACE FUNCTION @extschema@.create_hash_partitions(
55
relationTEXT
66
, attributeTEXT
77
, partitions_countINTEGER
8-
) RETURNSVOIDAS
8+
) RETURNSINTEGERAS
99
$$
1010
BEGIN
1111
relation := @extschema@.validate_relname(relation);
1212

1313
IF EXISTS (SELECT*FROM @extschema@.pathman_configWHERE relname= relation) THEN
14-
RAISE EXCEPTION'Reltion "%s" has already been partitioned', relation;
14+
RAISE EXCEPTION'Relation "%s" has already been partitioned', relation;
1515
END IF;
1616

1717
/* Create partitions and update pg_pathman configuration*/
@@ -42,6 +42,8 @@ BEGIN
4242

4343
/* Notify backend about changes*/
4444
PERFORM @extschema@.on_create_partitions(relation::regclass::oid);
45+
46+
RETURN partitions_count;
4547
END
4648
$$ LANGUAGE plpgsql;
4749

‎contrib/pg_pathman/sql/range.sql

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CREATE OR REPLACE FUNCTION @extschema@.create_range_partitions(
77
, p_start_value ANYELEMENT
88
, p_interval INTERVAL
99
, p_premakeINTEGER)
10-
RETURNSVOIDAS
10+
RETURNSINTEGERAS
1111
$$
1212
DECLARE
1313
v_valueTEXT;
@@ -16,7 +16,7 @@ BEGIN
1616
p_relation := @extschema@.validate_relname(p_relation);
1717

1818
IF EXISTS (SELECT*FROM @extschema@.pathman_configWHERE relname= p_relation) THEN
19-
RAISE EXCEPTION'Reltion "%" has already been partitioned', p_relation;
19+
RAISE EXCEPTION'Relation "%" has already been partitioned', p_relation;
2020
END IF;
2121

2222
EXECUTE format('DROP SEQUENCE IF EXISTS %s_seq', p_relation);
@@ -39,6 +39,8 @@ BEGIN
3939
-- PERFORM create_hash_update_trigger(relation, attribute, partitions_count);
4040
/* Notify backend about changes*/
4141
PERFORM @extschema@.on_create_partitions(p_relation::regclass::oid);
42+
43+
RETURN p_premake+1;
4244
END
4345
$$ LANGUAGE plpgsql;
4446

@@ -51,7 +53,7 @@ CREATE OR REPLACE FUNCTION @extschema@.create_range_partitions(
5153
, p_start_value ANYELEMENT
5254
, p_interval ANYELEMENT
5355
, p_premakeINTEGER)
54-
RETURNSVOIDAS
56+
RETURNSINTEGERAS
5557
$$
5658
DECLARE
5759
v_valueTEXT;
@@ -60,7 +62,7 @@ BEGIN
6062
p_relation := @extschema@.validate_relname(p_relation);
6163

6264
IF EXISTS (SELECT*FROM @extschema@.pathman_configWHERE relname= p_relation) THEN
63-
RAISE EXCEPTION'Reltion "%" has already been partitioned', p_relation;
65+
RAISE EXCEPTION'Relation "%" has already been partitioned', p_relation;
6466
END IF;
6567

6668
EXECUTE format('DROP SEQUENCE IF EXISTS %s_seq', p_relation);
@@ -83,6 +85,8 @@ BEGIN
8385
-- PERFORM create_hash_update_trigger(relation, attribute, partitions_count);
8486
/* Notify backend about changes*/
8587
PERFORM @extschema@.on_create_partitions(p_relation::regclass::oid);
88+
89+
RETURN p_premake+1;
8690
END
8791
$$ LANGUAGE plpgsql;
8892

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp