@@ -161,7 +161,46 @@ Now let's create new partition. You can use append_partition() or prepend_partit
161
161
SELECT append_partition('range_rel');
162
162
SELECT prepend_partition('range_rel');
163
163
```
164
+ ###Disable pg_pathman
165
+ To disable pg_pathman for some previously partitioned table use disable_pathman() function:
166
+ ```
167
+ SELECT disable_pathman('range_rel');
168
+ ```
169
+ All sections and data will stay available and will be handled by standard PostgreSQL partitioning mechanism.
170
+ ###Manual partitions management
171
+ It is possible to manage partitions manually. After creating or removing child tables it's necessary to invoke function:
172
+ ```
173
+ on_update_partitions(oid),
174
+ ```
175
+ which updates internal structures in memory of` pg_pathman module ` . For example, let's create new section for the` range_rel ` from above:
176
+ ```
177
+ CREATE TABLE range_rel_archive (CHECK (dt >= '2000-01-01' AND dt < '2010-01-01')) INHERITS (range_rel);
178
+ SELECT on_update_partitions('range_rel'::regclass::oid);
179
+ ```
180
+ CHECK CONSTRAINT must have the exact format:
181
+ * (VARIABLE >= CONST AND VARIABLE < CONST) for RANGE partitioned tables;
182
+ * (VARIABLE % CONST = CONST) for HASH partitioned tables.
183
+
184
+ It is possible to create partition from foreign table as well:
185
+ ```
186
+ CREATE FOREIGN TABLE range_rel_archive (
187
+ id INTEGER NOT NULL,
188
+ dt TIMESTAMP)
189
+ SERVER archive_server;
190
+ ALTER TABLE range_rel_archive INHERIT range_rel;
191
+ ALTER TABLE range_rel_archive ADD CHECK (dt >= '2000-01-01' AND dt < '2010-01-01');
192
+ SELECT on_update_partitions('range_rel'::regclass::oid);
193
+ ```
194
+ Foreign table structure must exactly match the parent table.
195
+
196
+ In case when parent table is being dropped by DROP TABLE, you should invoke on_remove_partitions() function and delete particular entry from` pathman_config ` table:
197
+ ```
198
+ SELECT on_remove_partitions('range_rel'::regclass::oid);
199
+ DROP TABLE range_rel CASCADE;
200
+ DELETE FROM pathman_config WHERE relname = 'public.range_rel';
201
+ ```
164
202
165
203
##Author
166
204
Ildar Musin <i.musin@postgrespro.ru > Postgres Professional Ltd., Russia
205
+
167
206
This module is sponsored by Postgres Professional Ltd., Russia