Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 65d2f20

Browse files
committed
fixup! Add more subpartitions fixes and tests
1 parent 8962277 commit 65d2f20

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

expected/pathman_subpartitions.out

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -380,24 +380,6 @@ SELECT create_range_partitions('subpartitions.abc_4', 'a', ARRAY[300, 350, 450])
380380
2
381381
(1 row)
382382

383-
\d+ subpartitions.abc_1
384-
Table "subpartitions.abc_1"
385-
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
386-
--------+---------+-----------+----------+---------+---------+--------------+-------------
387-
a | integer | | not null | | plain | |
388-
Check constraints:
389-
"pathman_abc_1_check" CHECK (a >= 0 AND a < 100)
390-
Inherits: subpartitions.abc
391-
Child tables: subpartitions.abc_1_1,
392-
subpartitions.abc_1_2,
393-
subpartitions.abc_1_3,
394-
subpartitions.abc_1_4,
395-
subpartitions.abc_1_5,
396-
subpartitions.abc_1_6,
397-
subpartitions.abc_1_7,
398-
subpartitions.abc_1_8,
399-
subpartitions.abc_1_9
400-
401383
SELECT * FROM pathman_partition_list;
402384
parent | partition | parttype | expr | range_min | range_max
403385
---------------------+------------------------+----------+------+-----------+-----------
@@ -464,14 +446,14 @@ DROP TABLE subpartitions.abc CASCADE;
464446
NOTICE: drop cascades to 39 other objects
465447
/* subpartitions on same expression but dates */
466448
CREATE TABLE subpartitions.abc(a DATE NOT NULL);
467-
INSERT INTO subpartitions.abc SELECT current_date + i FROM generate_series(1, 200, 20) as i;
468-
SELECT create_range_partitions('subpartitions.abc', 'a', current_date, '1 month'::INTERVAL);
449+
INSERT INTO subpartitions.abc SELECT '2017-10-02'::DATE + i FROM generate_series(1, 200, 20) as i;
450+
SELECT create_range_partitions('subpartitions.abc', 'a', '2017-10-02'::DATE, '1 month'::INTERVAL);
469451
create_range_partitions
470452
-------------------------
471453
6
472454
(1 row)
473455

474-
SELECT create_range_partitions('subpartitions.abc_1', 'a', current_date + 1,
456+
SELECT create_range_partitions('subpartitions.abc_1', 'a', '2017-10-02'::DATE + 1,
475457
'32 day'::INTERVAL, 10); /* not multiple, and limited p_count */
476458
WARNING: "start_value" was set to 10-02-2017
477459
WARNING: "p_interval" is not multiple of range (10-02-2017, 11-03-2017)

sql/pathman_subpartitions.sql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ SELECT create_range_partitions('subpartitions.abc_3', 'a', 200, 11, 20); /* too
119119
SELECT create_range_partitions('subpartitions.abc_4', 'a', ARRAY[301, 350, 400]); /* bounds check */
120120
SELECT create_range_partitions('subpartitions.abc_4', 'a', ARRAY[300, 450, 500]); /* bounds check */
121121
SELECT create_range_partitions('subpartitions.abc_4', 'a', ARRAY[300, 350, 450]); /* bounds check */
122-
\d+ subpartitions.abc_1
123122
SELECT * FROM pathman_partition_list;
124123
SELECT append_range_partition('subpartitions.abc_1'::regclass);
125124
SELECT append_range_partition('subpartitions.abc_1'::regclass);
@@ -138,9 +137,9 @@ DROP TABLE subpartitions.abc CASCADE;
138137

139138
/* subpartitions on same expression but dates */
140139
CREATE TABLE subpartitions.abc(a DATE NOT NULL);
141-
INSERT INTO subpartitions.abc SELECT current_date + i FROM generate_series(1, 200, 20) as i;
142-
SELECT create_range_partitions('subpartitions.abc', 'a', current_date, '1 month'::INTERVAL);
143-
SELECT create_range_partitions('subpartitions.abc_1', 'a', current_date + 1,
140+
INSERT INTO subpartitions.abc SELECT '2017-10-02'::DATE + i FROM generate_series(1, 200, 20) as i;
141+
SELECT create_range_partitions('subpartitions.abc', 'a', '2017-10-02'::DATE, '1 month'::INTERVAL);
142+
SELECT create_range_partitions('subpartitions.abc_1', 'a', '2017-10-02'::DATE + 1,
144143
'32 day'::INTERVAL, 10); /* not multiple, and limited p_count */
145144

146145
DROP TABLE subpartitions.abc CASCADE;

0 commit comments

Comments
 (0)