diff --git a/src/common/backend/catalog/pg_partition.cpp b/src/common/backend/catalog/pg_partition.cpp index a6a8490bf277d42bb8cd62d0e6e292222f19c524..ed1dc256d412bf1c2b8aa0673692ec04af788388 100644 --- a/src/common/backend/catalog/pg_partition.cpp +++ b/src/common/backend/catalog/pg_partition.cpp @@ -1048,26 +1048,18 @@ void freePartList(List* plist) ListCell* tuplecell = NULL; HeapTuple tuple = NULL; - foreach (tuplecell, plist) { + tuplecell = list_head(plist); + while (tuplecell != NULL) { + ListCell* tmp = tuplecell; tuple = (HeapTuple)lfirst(tuplecell); + tuplecell = lnext(tuplecell); + if (HeapTupleIsValid(tuple)) { heap_freetuple_ext(tuple); } - } - - if (PointerIsValid(plist)) { - pfree_ext(plist); - } -} - -void freeSubPartList(List* plist) -{ - ListCell* cell = NULL; - - foreach (cell, plist) { - List *subParts = (List *)lfirst(cell); - freePartList(subParts); + + pfree(tmp); } if (PointerIsValid(plist)) { diff --git a/src/include/catalog/pg_partition_fn.h b/src/include/catalog/pg_partition_fn.h index ecec5ec58408031bf55b4c40a61a4f95ad5ab64d..db2fb91ad5fa01c946e4d5c7cb0b66e7bad4ffd5 100644 --- a/src/include/catalog/pg_partition_fn.h +++ b/src/include/catalog/pg_partition_fn.h @@ -248,7 +248,6 @@ extern List *searchPgPartitionByParentId(char parttype, Oid parentId, ScanDirect extern List *searchPgSubPartitionByParentId(char parttype, List *parentOids, ScanDirection direction = ForwardScanDirection); extern void freePartList(List *l); -extern void freeSubPartList(List* plist); extern HeapTuple searchPgPartitionByParentIdCopy(char parttype, Oid parentId); extern Oid GetBaseRelOidOfParition(Relation relation);