Function pgPartitionAncestors