@@ -12,6 +12,127 @@ SELECT debug_capture();
1212set client_min_messages = NOTICE;
1313/* create table to be partitioned */
1414CREATE TABLE calamity.part_test(val serial);
15+ /* test pg_pathman's cache */
16+ INSERT INTO calamity.part_test SELECT generate_series(1, 30);
17+ SELECT create_range_partitions('calamity.part_test', 'val', 1, 10);
18+ NOTICE: sequence "part_test_seq" does not exist, skipping
19+ create_range_partitions
20+ -------------------------
21+ 3
22+ (1 row)
23+
24+ SELECT drop_partitions('calamity.part_test');
25+ NOTICE: function calamity.part_test_upd_trig_func() does not exist, skipping
26+ NOTICE: 10 rows copied from calamity.part_test_1
27+ NOTICE: 10 rows copied from calamity.part_test_2
28+ NOTICE: 10 rows copied from calamity.part_test_3
29+ drop_partitions
30+ -----------------
31+ 3
32+ (1 row)
33+
34+ SELECT create_range_partitions('calamity.part_test', 'val', 1, 10);
35+ create_range_partitions
36+ -------------------------
37+ 3
38+ (1 row)
39+
40+ SELECT drop_partitions('calamity.part_test');
41+ NOTICE: function calamity.part_test_upd_trig_func() does not exist, skipping
42+ NOTICE: 10 rows copied from calamity.part_test_1
43+ NOTICE: 10 rows copied from calamity.part_test_2
44+ NOTICE: 10 rows copied from calamity.part_test_3
45+ drop_partitions
46+ -----------------
47+ 3
48+ (1 row)
49+
50+ SELECT create_range_partitions('calamity.part_test', 'val', 1, 10);
51+ create_range_partitions
52+ -------------------------
53+ 3
54+ (1 row)
55+
56+ SELECT append_range_partition('calamity.part_test');
57+ append_range_partition
58+ ------------------------
59+ calamity.part_test_4
60+ (1 row)
61+
62+ SELECT drop_partitions('calamity.part_test');
63+ NOTICE: function calamity.part_test_upd_trig_func() does not exist, skipping
64+ NOTICE: 10 rows copied from calamity.part_test_1
65+ NOTICE: 10 rows copied from calamity.part_test_2
66+ NOTICE: 10 rows copied from calamity.part_test_3
67+ NOTICE: 0 rows copied from calamity.part_test_4
68+ drop_partitions
69+ -----------------
70+ 4
71+ (1 row)
72+
73+ SELECT create_range_partitions('calamity.part_test', 'val', 1, 10);
74+ create_range_partitions
75+ -------------------------
76+ 3
77+ (1 row)
78+
79+ SELECT append_range_partition('calamity.part_test');
80+ append_range_partition
81+ ------------------------
82+ calamity.part_test_4
83+ (1 row)
84+
85+ SELECT drop_partitions('calamity.part_test');
86+ NOTICE: function calamity.part_test_upd_trig_func() does not exist, skipping
87+ NOTICE: 10 rows copied from calamity.part_test_1
88+ NOTICE: 10 rows copied from calamity.part_test_2
89+ NOTICE: 10 rows copied from calamity.part_test_3
90+ NOTICE: 0 rows copied from calamity.part_test_4
91+ drop_partitions
92+ -----------------
93+ 4
94+ (1 row)
95+
96+ SELECT count(*) FROM calamity.part_test;
97+ count
98+ -------
99+ 30
100+ (1 row)
101+
102+ DELETE FROM calamity.part_test;
103+ /* test stub 'enable_parent' value for PATHMAN_CONFIG_PARAMS */
104+ INSERT INTO calamity.part_test SELECT generate_series(1, 30);
105+ SELECT create_range_partitions('calamity.part_test', 'val', 1, 10);
106+ create_range_partitions
107+ -------------------------
108+ 3
109+ (1 row)
110+
111+ DELETE FROM pathman_config_params WHERE partrel = 'calamity.part_test'::regclass;
112+ SELECT append_range_partition('calamity.part_test');
113+ append_range_partition
114+ ------------------------
115+ calamity.part_test_4
116+ (1 row)
117+
118+ EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_test;
119+ QUERY PLAN
120+ -------------------------------
121+ Append
122+ -> Seq Scan on part_test_1
123+ -> Seq Scan on part_test_2
124+ -> Seq Scan on part_test_3
125+ -> Seq Scan on part_test_4
126+ (5 rows)
127+
128+ SELECT drop_partitions('calamity.part_test', true);
129+ NOTICE: function calamity.part_test_upd_trig_func() does not exist, skipping
130+ drop_partitions
131+ -----------------
132+ 4
133+ (1 row)
134+
135+ DELETE FROM calamity.part_test;
15136/* check function build_hash_condition() */
16137SELECT build_hash_condition('int4', 'val', 10, 1);
17138 build_hash_condition
@@ -204,6 +325,9 @@ SELECT build_update_trigger_func_name(NULL) IS NULL;
204325 t
205326(1 row)
206327
328+ /* check function stop_concurrent_part_task() */
329+ SELECT stop_concurrent_part_task(1::regclass);
330+ ERROR: cannot find worker for relation "1"
207331/* check invoke_on_partition_created_callback() for RANGE */
208332SELECT invoke_on_partition_created_callback('calamity.part_test', 'calamity.part_test', 1, NULL, NULL::int);
209333ERROR: both bounds must be provided for RANGE partition
@@ -393,5 +517,5 @@ SELECT count(*) FROM pathman_config_params WHERE partrel = 'calamity.to_be_disab
393517(1 row)
394518
395519DROP SCHEMA calamity CASCADE;
396- NOTICE: drop cascades to15 other objects
520+ NOTICE: drop cascades to16 other objects
397521DROP EXTENSION pg_pathman;