PostgreSQL Source Code: src/backend/utils/adt/amutils.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
15
22
23
24
26{
29};
30
32{
33 {
35 },
36 {
38 },
39 {
41 },
42 {
44 },
45 {
47 },
48 {
50 },
51 {
53 },
54 {
56 },
57 {
59 },
60 {
62 },
63 {
65 },
66 {
68 },
69 {
71 },
72 {
74 },
75 {
77 },
78 {
80 },
81 {
83 },
84 {
86 },
87};
88
91{
92 int i;
93
95 {
98 }
99
100
102}
103
104
105
106
107
108
109
110
111
112
113
114
115
116static bool
119 bool *res)
120{
123 int16 indoption_val;
124
125 if (!guard)
126 {
127 *res = false;
128 return true;
129 }
130
132
134 indoption_val = indoption->values[attno - 1];
135
136 *res = (indoption_val & iopt_mask) == iopt_expect;
137
138 return true;
139}
140
141
142
143
144
145
146
147
148
149
152 const char *propname,
153 Oid amoid, Oid index_oid, int attno)
154{
155 bool res = false;
156 bool isnull = false;
157 int natts = 0;
160
161
163
164
166 {
169
175 if (rd_rel->relkind != RELKIND_INDEX &&
176 rd_rel->relkind != RELKIND_PARTITIONED_INDEX)
177 {
180 }
181 amoid = rd_rel->relam;
182 natts = rd_rel->relnatts;
184 }
185
186
187
188
189
190
191
192 if (attno < 0 || attno > natts)
194
195
196
197
199 if (routine == NULL)
201
202
203
204
205
207 routine->amproperty(index_oid, attno, prop, propname,
208 &res, &isnull))
209 {
210 if (isnull)
213 }
214
215 if (attno > 0)
216 {
219 bool iskey = true;
220
221
222
223
224
225
230
231 Assert(index_oid == rd_index->indexrelid);
232 Assert(attno > 0 && attno <= rd_index->indnatts);
233
234 isnull = true;
235
236
237
238
239
240
242 && attno > rd_index->indnkeyatts)
243 iskey = false;
244
245 switch (prop)
246 {
248 if (iskey &&
250 INDOPTION_DESC, 0, &res))
251 isnull = false;
252 break;
253
255 if (iskey &&
257 INDOPTION_DESC, INDOPTION_DESC, &res))
258 isnull = false;
259 break;
260
262 if (iskey &&
264 INDOPTION_NULLS_FIRST, INDOPTION_NULLS_FIRST, &res))
265 isnull = false;
266 break;
267
269 if (iskey &&
271 INDOPTION_NULLS_FIRST, 0, &res))
272 isnull = false;
273 break;
274
276
277
278
279
280 res = iskey ? routine->amcanorder : false;
281 isnull = false;
282 break;
283
285
286
287
288
289
290
291
292
293
294
295
296
297
299 {
300 res = false;
301 isnull = false;
302 }
303 break;
304
306
307
308
309 isnull = false;
310 res = false;
311
313 {
314
315
316
317
318
320
323 }
324 break;
325
327 if (iskey)
328 {
330 isnull = false;
331 }
332 break;
333
335 if (iskey)
336 {
338 isnull = false;
339 }
340 break;
341
342 default:
343 break;
344 }
345
347
348 if (!isnull)
351 }
352
354 {
355
356
357
358
359
360 switch (prop)
361 {
364
367
370
373
374 default:
376 }
377 }
378
379
380
381
382
383 switch (prop)
384 {
387
390
393
396
399
400 default:
402 }
403}
404
405
406
407
410{
413
415}
416
417
418
419
422{
425
427}
428
429
430
431
434{
438
439
440 if (attno <= 0)
442
444}
445
446
447
448
449
452{
457
461
465
467}
IndexAmRoutine * GetIndexAmRoutineByAmId(Oid amoid, bool noerror)
@ AMPROP_DISTANCE_ORDERABLE
static const struct am_propname am_propnames[]
static Datum indexam_property(FunctionCallInfo fcinfo, const char *propname, Oid amoid, Oid index_oid, int attno)
Datum pg_index_column_has_property(PG_FUNCTION_ARGS)
Datum pg_indexam_progress_phasename(PG_FUNCTION_ARGS)
Datum pg_index_has_property(PG_FUNCTION_ARGS)
Datum pg_indexam_has_property(PG_FUNCTION_ARGS)
static IndexAMProperty lookup_prop_name(const char *name)
static bool test_indoption(HeapTuple tuple, int attno, bool guard, int16 iopt_mask, int16 iopt_expect, bool *res)
#define CStringGetTextDatum(s)
#define OidIsValid(objectId)
#define PG_GETARG_TEXT_PP(n)
#define PG_GETARG_INT32(n)
#define PG_RETURN_DATUM(x)
#define PG_RETURN_BOOL(x)
Assert(PointerIsAligned(start, uint64))
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void index_close(Relation relation, LOCKMODE lockmode)
bool index_can_return(Relation indexRelation, int attno)
Relation index_open(Oid relationId, LOCKMODE lockmode)
FormData_pg_class * Form_pg_class
FormData_pg_index * Form_pg_index
int pg_strcasecmp(const char *s1, const char *s2)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
ambuildphasename_function ambuildphasename
amgettuple_function amgettuple
amcanreturn_function amcanreturn
amgetbitmap_function amgetbitmap
amproperty_function amproperty
int16 values[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
char * text_to_cstring(const text *t)