PostgreSQL Source Code: src/backend/utils/adt/partitionfuncs.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
17
23#include "utils/fmgrprotos.h"
26
27
28
29
30
31
32
33static bool
35{
36 char relkind;
37 bool relispartition;
38
39
41 return false;
42
45
46
47 if (!relispartition && !RELKIND_HAS_PARTITIONS(relkind))
48 return false;
49
50 return true;
51}
52
53
54
55
56
57
58
59
60
63{
64#define PG_PARTITION_TREE_COLS 4
68
69
71 {
74
75
77
80
81
83
84
85
86
87
89
91 elog(ERROR, "return type must be a row type");
93
94
96
98 }
99
100
103
105 {
113 int level = 0;
116
117
118
119
120
121
123
124
125 if (ancestors != NIL)
129 else
130 nulls[1] = true;
131
132
134
135
136 if (relid != rootrelid)
137 {
138 foreach(lc, ancestors)
139 {
140 level++;
142 break;
143 }
144 }
146
150 }
151
152
154}
155
156
157
158
159
160
161
162
165{
167 Oid rootrelid;
168 List *ancestors;
169
172
173
175
176
177
178
179
180 if (ancestors == NIL)
182
183 rootrelid = llast_oid(ancestors);
185
186
187
188
189
192}
193
194
195
196
197
198
199
202{
205 List *ancestors;
206
208 {
210
212
215
217
219 ancestors = lcons_oid(relid, ancestors);
220
221
223
225 }
226
229
231 {
233
235 }
236
238}
static Datum values[MAXATTR]
#define OidIsValid(objectId)
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
#define SRF_RETURN_DONE(_funcctx)
Assert(PointerIsAligned(start, uint64))
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
if(TABLE==NULL||TABLE_index==NULL)
List * lcons_oid(Oid datum, List *list)
void list_free(List *list)
bool get_rel_relispartition(Oid relid)
char get_rel_relkind(Oid relid)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
List * get_partition_ancestors(Oid relid)
Datum pg_partition_tree(PG_FUNCTION_ARGS)
#define PG_PARTITION_TREE_COLS
Datum pg_partition_root(PG_FUNCTION_ARGS)
static bool check_rel_can_be_partition(Oid relid)
Datum pg_partition_ancestors(PG_FUNCTION_ARGS)
List * find_all_inheritors(Oid parentrelId, LOCKMODE lockmode, List **numparents)
static int list_length(const List *l)
static Oid list_nth_oid(const List *list, int n)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
static Datum Int32GetDatum(int32 X)
MemoryContext multi_call_memory_ctx
#define SearchSysCacheExists1(cacheId, key1)