PostgreSQL Source Code  git master
partdesc.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * partdesc.h
4  *
5  * Copyright (c) 1996-2021, PostgreSQL Global Development Group
6  *
7  * src/include/partitioning/partdesc.h
8  *
9  *-------------------------------------------------------------------------
10  */
11 
12 #ifndef PARTDESC_H
13 #define PARTDESC_H
14 
15 #include "partitioning/partdefs.h"
16 #include "utils/relcache.h"
17 
18 /*
19  * Information about partitions of a partitioned table.
20  *
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
27  * right time.)
28  */
29 typedef struct PartitionDescData
30 {
31  int nparts; /* Number of partitions */
32  bool detached_exist; /* Are there any detached partitions? */
33  Oid *oids; /* Array of 'nparts' elements containing
34  * partition OIDs in order of the 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 */
38  PartitionBoundInfo boundinfo; /* collection of partition bounds */
40 
41 
42 extern PartitionDesc RelationGetPartitionDesc(Relation rel, bool omit_detached);
43 
44 extern PartitionDirectory CreatePartitionDirectory(MemoryContext mcxt, bool omit_detached);
47 
49 
50 #endif /* PARTCACHE_H */
void DestroyPartitionDirectory(PartitionDirectory pdir)
Definition: partdesc.c:438
PartitionDesc RelationGetPartitionDesc(Relation rel, bool omit_detached)
Definition: partdesc.c:72
bool * is_leaf
Definition: partdesc.h:35
unsigned int Oid
Definition: postgres_ext.h:31
Oid get_default_oid_from_partdesc(PartitionDesc partdesc)
Definition: partdesc.c:455
PartitionBoundInfo boundinfo
Definition: partdesc.h:38
bool detached_exist
Definition: partdesc.h:32
PartitionDesc PartitionDirectoryLookup(PartitionDirectory, Relation)
Definition: partdesc.c:410
PartitionDirectory CreatePartitionDirectory(MemoryContext mcxt, bool omit_detached)
Definition: partdesc.c:377
struct PartitionDescData PartitionDescData