Skip to content

Commit e2d29d2

Browse files
committed
Check for children array size sanity in fill_prel_with_partitions.
... which might be violated if has partition was dropped.
1 parent e402512 commit e2d29d2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/relation_info.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,18 @@ fill_prel_with_partitions(PartRelationInfo *prel,
755755
switch (prel->parttype)
756756
{
757757
case PT_HASH:
758+
/*
759+
* This might be the case if hash part was dropped, and thus
760+
* children array alloc'ed smaller than needed, but parts
761+
* bound cache still keeps entries with high indexes.
762+
*/
763+
if (pbin->part_idx >= PrelChildrenCount(prel))
764+
ereport(ERROR, (errmsg("pg_pathman's cache for relation \"%s\" "
765+
"has not been properly initialized. "
766+
"Looks like one of hash partitions was dropped.",
767+
get_rel_name_or_relid(PrelParentRelid(prel))),
768+
errhint(INIT_ERROR_HINT)));
769+
758770
prel->children[pbin->part_idx] = pbin->child_relid;
759771
break;
760772

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