PostgreSQL Source Code  git master
partcache.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * partcache.h
4  *
5  * Copyright (c) 1996-2019, PostgreSQL Global Development Group
6  *
7  * src/include/utils/partcache.h
8  *
9  *-------------------------------------------------------------------------
10  */
11 #ifndef PARTCACHE_H
12 #define PARTCACHE_H
13 
14 #include "access/attnum.h"
15 #include "fmgr.h"
16 #include "nodes/pg_list.h"
17 #include "nodes/primnodes.h"
18 #include "partitioning/partdefs.h"
19 #include "utils/relcache.h"
20 
21 /*
22  * Information about the partition key of a relation
23  */
24 typedef struct PartitionKeyData
25 {
26  char strategy; /* partitioning strategy */
27  int16 partnatts; /* number of columns in the partition key */
28  AttrNumber *partattrs; /* attribute numbers of columns in the
29  * partition key or 0 if it's an expr */
30  List *partexprs; /* list of expressions in the partitioning
31  * key, one for each zero-valued partattrs */
32 
33  Oid *partopfamily; /* OIDs of operator families */
34  Oid *partopcintype; /* OIDs of opclass declared input data types */
35  FmgrInfo *partsupfunc; /* lookup info for support funcs */
36 
37  /* Partitioning collation per attribute */
39 
40  /* Type information per attribute */
44  bool *parttypbyval;
45  char *parttypalign;
48 
49 extern void RelationBuildPartitionKey(Relation relation);
51 extern Expr *get_partition_qual_relid(Oid relid);
52 
53 /*
54  * PartitionKey inquiry functions
55  */
56 static inline int
58 {
59  return key->strategy;
60 }
61 
62 static inline int
64 {
65  return key->partnatts;
66 }
67 
68 static inline List *
70 {
71  return key->partexprs;
72 }
73 
74 /*
75  * PartitionKey inquiry functions - one column
76  */
77 static inline int16
79 {
80  return key->partattrs[col];
81 }
82 
83 static inline Oid
85 {
86  return key->parttypid[col];
87 }
88 
89 static inline int32
91 {
92  return key->parttypmod[col];
93 }
94 
95 static inline Oid
97 {
98  return key->partcollation[col];
99 }
100 
101 #endif /* PARTCACHE_H */
List * RelationGetPartitionQual(Relation rel)
Definition: partcache.c:256
signed short int16
Definition: c.h:345
Definition: fmgr.h:56
Expr * get_partition_qual_relid(Oid relid)
Definition: partcache.c:278
Oid * partopfamily
Definition: partcache.h:33
FmgrInfo * partsupfunc
Definition: partcache.h:35
static int32 get_partition_col_typmod(PartitionKey key, int col)
Definition: partcache.h:90
static Oid get_partition_col_typid(PartitionKey key, int col)
Definition: partcache.h:84
struct PartitionKeyData PartitionKeyData
static int get_partition_natts(PartitionKey key)
Definition: partcache.h:63
List * partexprs
Definition: partcache.h:30
unsigned int Oid
Definition: postgres_ext.h:31
signed int int32
Definition: c.h:346
static List * get_partition_exprs(PartitionKey key)
Definition: partcache.h:69
Oid * parttypcoll
Definition: partcache.h:46
void RelationBuildPartitionKey(Relation relation)
Definition: partcache.c:58
static int16 get_partition_col_attnum(PartitionKey key, int col)
Definition: partcache.h:78
Oid * partcollation
Definition: partcache.h:38
AttrNumber * partattrs
Definition: partcache.h:28
char * parttypalign
Definition: partcache.h:45
int32 * parttypmod
Definition: partcache.h:42
bool * parttypbyval
Definition: partcache.h:44
int16 * parttyplen
Definition: partcache.h:43
static Oid get_partition_col_collation(PartitionKey key, int col)
Definition: partcache.h:96
Oid * partopcintype
Definition: partcache.h:34
static int get_partition_strategy(PartitionKey key)
Definition: partcache.h:57
Definition: pg_list.h:50
int16 AttrNumber
Definition: attnum.h:21