Skip to content

Commit 2ec3923

Browse files
committed
Check that pathman is initialized in get_pathman_config_relid.
Also, check hash partitioned table consistency always, not under assert checking.
1 parent 079797e commit 2ec3923

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/pg_pathman.c

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,17 @@ _PG_init(void)
333333
Oid
334334
get_pathman_config_relid(bool invalid_is_ok)
335335
{
336+
if (!IsPathmanInitialized())
337+
{
338+
if (invalid_is_ok)
339+
return InvalidOid;
340+
elog(ERROR, "pg_pathman is not initialized yet");
341+
}
342+
336343
/* Raise ERROR if Oid is invalid */
337344
if (!OidIsValid(pathman_config_relid) && !invalid_is_ok)
338-
elog(ERROR,
339-
(!IsPathmanInitialized() ?
340-
"pg_pathman is not initialized yet" :
341-
"unexpected error in function "
342-
CppAsString(get_pathman_config_relid)));
345+
elog(ERROR, "unexpected error in function "
346+
CppAsString(get_pathman_config_relid));
343347

344348
return pathman_config_relid;
345349
}
@@ -348,13 +352,17 @@ get_pathman_config_relid(bool invalid_is_ok)
348352
Oid
349353
get_pathman_config_params_relid(bool invalid_is_ok)
350354
{
355+
if (!IsPathmanInitialized())
356+
{
357+
if (invalid_is_ok)
358+
return InvalidOid;
359+
elog(ERROR, "pg_pathman is not initialized yet");
360+
}
361+
351362
/* Raise ERROR if Oid is invalid */
352363
if (!OidIsValid(pathman_config_relid) && !invalid_is_ok)
353-
elog(ERROR,
354-
(!IsPathmanInitialized() ?
355-
"pg_pathman is not initialized yet" :
356-
"unexpected error in function "
357-
CppAsString(get_pathman_config_params_relid)));
364+
elog(ERROR, "unexpected error in function "
365+
CppAsString(get_pathman_config_params_relid));
358366

359367
return pathman_config_params_relid;
360368
}

src/relation_info.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,6 @@ fill_prel_with_partitions(PartRelationInfo *prel,
802802
prel->children[i] = prel->ranges[i].child_oid;
803803
}
804804

805-
#ifdef USE_ASSERT_CHECKING
806805
/* Check that each partition Oid has been assigned properly */
807806
if (prel->parttype == PT_HASH)
808807
for (i = 0; i < PrelChildrenCount(prel); i++)
@@ -815,7 +814,6 @@ fill_prel_with_partitions(PartRelationInfo *prel,
815814
get_rel_name_or_relid(PrelParentRelid(prel)));
816815
}
817816
}
818-
#endif
819817
}
820818

821819
/* qsort() comparison function for RangeEntries */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy