Skip to content

Commit 1d45b48

Browse files
committed
broken tests fixed
1 parent ab15bee commit 1d45b48

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

range.sql

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ DECLARE
102102
v_max start_value%TYPE;
103103
v_cur_value start_value%TYPE := start_value;
104104
end_value start_value%TYPE;
105-
part_count INTEGER;
105+
part_count INTEGER := 0;
106106
i INTEGER;
107107

108108
BEGIN
@@ -161,11 +161,13 @@ BEGIN
161161
PERFORM @extschema@.create_or_replace_sequence(parent_relid)
162162
FROM @extschema@.get_plain_schema_and_relname(parent_relid);
163163

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;
169171

170172
/* Notify backend about changes */
171173
PERFORM @extschema@.on_create_partitions(parent_relid);
@@ -199,7 +201,7 @@ DECLARE
199201
v_max start_value%TYPE;
200202
v_cur_value start_value%TYPE := start_value;
201203
end_value start_value%TYPE;
202-
part_count INTEGER;
204+
part_count INTEGER := 0;
203205
i INTEGER;
204206

205207
BEGIN
@@ -258,11 +260,13 @@ BEGIN
258260
PERFORM @extschema@.create_or_replace_sequence(parent_relid)
259261
FROM @extschema@.get_plain_schema_and_relname(parent_relid);
260262

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;
266270

267271
/* Notify backend about changes */
268272
PERFORM @extschema@.on_create_partitions(parent_relid);

src/pl_range_funcs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,6 @@ generate_bounds(PG_FUNCTION_ARGS)
11461146
get_typlenbyvalalign(v_type, &elemlen, &elembyval, &elemalign);
11471147

11481148
datums = palloc(sizeof(Datum) * (count + 1));
1149-
// datums[0] = datumCopy(value, elembyval, elemlen);
11501149
datums[0] = value;
11511150

11521151
/* calculate bounds */

0 commit comments

Comments
 (0)