@@ -102,7 +102,7 @@ DECLARE
102
102
v_max start_value%TYPE;
103
103
v_cur_value start_value%TYPE := start_value;
104
104
end_value start_value%TYPE;
105
- part_count INTEGER ;
105
+ part_count INTEGER : = 0 ;
106
106
i INTEGER ;
107
107
108
108
BEGIN
@@ -161,11 +161,13 @@ BEGIN
161
161
PERFORM @extschema@.create_or_replace_sequence(parent_relid)
162
162
FROM @extschema@.get_plain_schema_and_relname(parent_relid);
163
163
164
- part_count := @extschema@.create_range_partitions_internal(
165
- parent_relid,
166
- @extschema@.generate_bounds(start_value, p_interval, p_count),
167
- NULL ,
168
- NULL );
164
+ IF p_count != 0 THEN
165
+ part_count := @extschema@.create_range_partitions_internal(
166
+ parent_relid,
167
+ @extschema@.generate_bounds(start_value, p_interval, p_count),
168
+ NULL ,
169
+ NULL );
170
+ END IF;
169
171
170
172
/* Notify backend about changes */
171
173
PERFORM @extschema@.on_create_partitions(parent_relid);
@@ -199,7 +201,7 @@ DECLARE
199
201
v_max start_value%TYPE;
200
202
v_cur_value start_value%TYPE := start_value;
201
203
end_value start_value%TYPE;
202
- part_count INTEGER ;
204
+ part_count INTEGER : = 0 ;
203
205
i INTEGER ;
204
206
205
207
BEGIN
@@ -258,11 +260,13 @@ BEGIN
258
260
PERFORM @extschema@.create_or_replace_sequence(parent_relid)
259
261
FROM @extschema@.get_plain_schema_and_relname(parent_relid);
260
262
261
- part_count := @extschema@.create_range_partitions_internal(
262
- parent_relid,
263
- @extschema@.generate_bounds(start_value, p_interval, p_count),
264
- NULL ,
265
- NULL );
263
+ IF p_count != 0 THEN
264
+ part_count := @extschema@.create_range_partitions_internal(
265
+ parent_relid,
266
+ @extschema@.generate_bounds(start_value, p_interval, p_count),
267
+ NULL ,
268
+ NULL );
269
+ END IF;
266
270
267
271
/* Notify backend about changes */
268
272
PERFORM @extschema@.on_create_partitions(parent_relid);
0 commit comments