PostgreSQL Source Code: src/backend/access/gist/gistscan.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
16
24
25
26
27
28
29static int
31{
35 int i;
36
37
39 {
40 if (sa->distances[i].isnull)
41 {
43 return -1;
44 }
46 {
47 return 1;
48 }
49 else
50 {
53
54 if (cmp != 0)
55 return cmp;
56 }
57 }
58
59
61 return 1;
63 return -1;
64
65 return 0;
66}
67
68
69
70
71
72
75{
80
82
83
85
86
87
88
89
91
92
98
99
101 so->qual_ok = true;
103 {
107 }
108
109 so->killedItems = NULL;
113
115
116
117
118
119
120
122
123 return scan;
124}
125
126void
128 ScanKey orderbys, int norderbys)
129{
130
132 bool first_time;
133 int i;
135
136
137
138
139
140
141
142
143
144
145
146
147
149 {
150
152 first_time = true;
153 }
155 {
156
158 "GiST queue context",
160 first_time = false;
161 }
162 else
163 {
164
166 first_time = false;
167 }
168
169
170
171
172
173
175 {
176 int natts;
177 int nkeyatts;
178 int attno;
179
180
181
182
183
184
185
189 for (attno = 1; attno <= nkeyatts; attno++)
190 {
193 -1, 0);
194 }
195
196 for (; attno <= natts; attno++)
197 {
198
201 attno - 1)->atttypid,
202 -1, 0);
203 }
205
206
208 "GiST page data context",
210 }
211
212
216
218
219
221 {
222 void **fn_extras = NULL;
223
224
225
226
227
228
229 if (!first_time)
230 {
234 }
235
237
238
239
240
241
242
243
244
245
246
247
248
250
252 {
254
255
256
257
258
262
263
264 if (!first_time)
266
268 {
271 }
272 }
273
274 if (!first_time)
275 pfree(fn_extras);
276 }
277
278
280 {
281 void **fn_extras = NULL;
282
283
284 if (!first_time)
285 {
289 }
290
292
294
295
296
297
298
299
300
301
303 {
306
307
309 elog(ERROR, "missing support function %d for attribute %d of index \"%s\"",
312
313
314
315
316
317
318
319
320
321
322
323
324
326
327
328
329
330
332
333
334 if (!first_time)
336 }
337
338 if (!first_time)
339 pfree(fn_extras);
340 }
341
342
344}
345
346void
348{
350
351
352
353
354
356}
#define InvalidBlockNumber
#define OidIsValid(objectId)
int float8_cmp_internal(float8 a, float8 b)
void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo, MemoryContext destcxt)
IndexScanDesc RelationGetIndexScan(Relation indexRelation, int nkeys, int norderbys)
struct IndexScanDescData * IndexScanDesc
GISTSTATE * initGISTstate(Relation index)
MemoryContext createTempGistContext(void)
void freeGISTstate(GISTSTATE *giststate)
#define GIST_DISTANCE_PROC
GISTScanOpaqueData * GISTScanOpaque
#define GISTSearchItemIsHeap(item)
IndexScanDesc gistbeginscan(Relation r, int nkeys, int norderbys)
void gistendscan(IndexScanDesc scan)
void gistrescan(IndexScanDesc scan, ScanKey key, int nkeys, ScanKey orderbys, int norderbys)
static int pairingheap_GISTSearchItem_cmp(const pairingheap_node *a, const pairingheap_node *b, void *arg)
Assert(PointerIsAligned(start, uint64))
if(TABLE==NULL||TABLE_index==NULL)
Oid get_func_rettype(Oid funcid)
void MemoryContextReset(MemoryContext context)
void pfree(void *pointer)
void * palloc0(Size size)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
pairingheap * pairingheap_allocate(pairingheap_comparator compare, void *arg)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static int cmp(const chr *x, const chr *y, size_t len)
#define RelationGetNumberOfAttributes(relation)
#define RelationGetRelationName(relation)
#define IndexRelationGetNumberOfKeyAttributes(relation)
FmgrInfo distanceFn[INDEX_MAX_KEYS]
FmgrInfo consistentFn[INDEX_MAX_KEYS]
OffsetNumber * killedItems
IndexOrderByDistance * distances
MemoryContext pageDataCxt
IndexOrderByDistance distances[FLEXIBLE_ARRAY_MEMBER]
struct ScanKeyData * keyData
struct ScanKeyData * orderByData
struct TupleDescData * xs_hitupdesc
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
#define InvalidXLogRecPtr