1/*-------------------------------------------------------------------------
5 * Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * src/include/partitioning/partdesc.h
9 *-------------------------------------------------------------------------
19 * Information about partitions of a partitioned table.
21 * For partitioned tables where detached partitions exist, we only cache
22 * descriptors that include all partitions, including detached; when we're
23 * requested a descriptor without the detached partitions, we create one
24 * afresh each time. (The reason for this is that the set of detached
25 * partitions that are visible to each caller depends on the snapshot it has,
26 * so it's pretty much impossible to evict a descriptor from cache at the
31 int nparts;
/* Number of partitions */
33 Oid *
oids;
/* Array of 'nparts' elements containing
34 * partition OIDs in order of their bounds */
35 bool *
is_leaf;
/* Array of 'nparts' elements storing whether
36 * the corresponding 'oids' element belongs to
37 * a leaf partition or not */
40 /* Caching fields to cache lookups in get_partition_for_tuple() */
43 * Index into the PartitionBoundInfo's datum array for the last found
44 * partition or -1 if none.
49 * Partition index of the last found partition or -1 if none has been
55 * For LIST partitioning, this is the number of times in a row that the
56 * datum we're looking for a partition for matches the datum in the
57 * last_found_datum_index index of the boundinfo->datums array. For RANGE
58 * partitioning, this is the number of times in a row we've found that the
59 * datum we're looking for a partition for falls into the range of the
60 * partition corresponding to the last_found_datum_index index of the
61 * boundinfo->datums array.
75#endif /* PARTDESC_H */
PartitionDesc PartitionDirectoryLookup(PartitionDirectory, Relation)
PartitionDirectory CreatePartitionDirectory(MemoryContext mcxt, bool omit_detached)
void DestroyPartitionDirectory(PartitionDirectory pdir)
PartitionDesc RelationGetPartitionDesc(Relation rel, bool omit_detached)
struct PartitionDescData PartitionDescData
Oid get_default_oid_from_partdesc(PartitionDesc partdesc)
int last_found_datum_index
PartitionBoundInfo boundinfo
int last_found_part_index