Skip to content

Commit 8de9ace

Browse files
committed
pathman: initialization check added
1 parent 4299f24 commit 8de9ace

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

contrib/pathman/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ load_check_constraints(Oid parent_oid)
292292
{
293293
if (ranges[i].max > ranges[i+1].min)
294294
{
295-
elog(WARNING, "Partitions %u and %u overlap. Disabling pathman for relation %u..",
295+
elog(WARNING, "Partitions %u and %u overlap. Disabling pathman for relation %u...",
296296
ranges[i].child_oid, ranges[i+1].child_oid, parent_oid);
297297
hash_search(relations, (const void *) &parent_oid, HASH_REMOVE, &found);
298298
}

contrib/pathman/pathman.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "pathman.h"
22
#include "postgres.h"
33
#include "fmgr.h"
4+
#include "miscadmin.h"
45
#include "nodes/nodeFuncs.h"
56
#include "nodes/pg_list.h"
67
#include "nodes/relation.h"
@@ -100,6 +101,14 @@ static void set_pathkeys(PlannerInfo *root, RelOptInfo *childrel, Path *path);
100101
void
101102
_PG_init(void)
102103
{
104+
if (IsUnderPostmaster)
105+
{
106+
elog(ERROR, "Pathman module must be initialized in postmaster. "
107+
"Put the following line to configuration file: "
108+
"shared_preload_library = 'pathman'");
109+
initialization_needed = false;
110+
}
111+
103112
set_rel_pathlist_hook_original = set_rel_pathlist_hook;
104113
set_rel_pathlist_hook = pathman_set_rel_pathlist_hook;
105114
shmem_startup_hook_original = shmem_startup_hook;

0 commit comments

Comments
 (0)