Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc60d242

Browse files
committed
critical bugfix related to bitmapset usage
1 parentfea036c commitc60d242

File tree

2 files changed

+45
-6
lines changed

2 files changed

+45
-6
lines changed

‎README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,46 @@ Now let's create new partition. You can use append_partition() or prepend_partit
161161
SELECT append_partition('range_rel');
162162
SELECT prepend_partition('range_rel');
163163
```
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+
```
164202

165203
##Author
166204
Ildar Musin <i.musin@postgrespro.ru> Postgres Professional Ltd., Russia
205+
167206
This module is sponsored by Postgres Professional Ltd., Russia

‎pg_pathman.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -552,18 +552,18 @@ change_varnos_in_restrinct_info(RestrictInfo *rinfo, change_varno_context *conte
552552
/* TODO: find some elegant way to do this */
553553
if (bms_is_member(context->old_varno,rinfo->clause_relids))
554554
{
555-
bms_del_member(rinfo->clause_relids,context->old_varno);
556-
bms_add_member(rinfo->clause_relids,context->new_varno);
555+
rinfo->clause_relids=bms_del_member(rinfo->clause_relids,context->old_varno);
556+
rinfo->clause_relids=bms_add_member(rinfo->clause_relids,context->new_varno);
557557
}
558558
if (bms_is_member(context->old_varno,rinfo->left_relids))
559559
{
560-
bms_del_member(rinfo->left_relids,context->old_varno);
561-
bms_add_member(rinfo->left_relids,context->new_varno);
560+
rinfo->left_relids=bms_del_member(rinfo->left_relids,context->old_varno);
561+
rinfo->left_relids=bms_add_member(rinfo->left_relids,context->new_varno);
562562
}
563563
if (bms_is_member(context->old_varno,rinfo->right_relids))
564564
{
565-
bms_del_member(rinfo->right_relids,context->old_varno);
566-
bms_add_member(rinfo->right_relids,context->new_varno);
565+
rinfo->right_relids=bms_del_member(rinfo->right_relids,context->old_varno);
566+
rinfo->right_relids=bms_add_member(rinfo->right_relids,context->new_varno);
567567
}
568568
}
569569

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp