PostgreSQL Source Code: src/backend/access/gin/ginarrayproc.c File Reference (original) (raw)
#include "[postgres.h](postgres%5F8h%5Fsource.html)"
#include "[access/gin.h](gin%5F8h%5Fsource.html)"
#include "[access/stratnum.h](stratnum%5F8h%5Fsource.html)"
#include "[utils/array.h](array%5F8h%5Fsource.html)"
#include "utils/fmgrprotos.h"
#include "[utils/lsyscache.h](lsyscache%5F8h%5Fsource.html)"
Go to the source code of this file.
Macros | |
---|---|
#define | GinOverlapStrategy 1 |
#define | GinContainsStrategy 2 |
#define | GinContainedStrategy 3 |
#define | GinEqualStrategy 4 |
◆ GinContainedStrategy
#define GinContainedStrategy 3
◆ GinContainsStrategy
#define GinContainsStrategy 2
◆ GinEqualStrategy
#define GinEqualStrategy 4
◆ GinOverlapStrategy
#define GinOverlapStrategy 1
◆ ginarrayconsistent()
Definition at line 142 of file ginarrayproc.c.
143{
146
147
149
150
152
153
155 bool res;
157
158 switch (strategy)
159 {
161
162 *recheck = false;
163
164 res = false;
165 for (i = 0; i < nkeys; i++)
166 {
167 if (check[i] && !nullFlags[i])
168 {
169 res = true;
170 break;
171 }
172 }
173 break;
175
176 *recheck = false;
177
178 res = true;
179 for (i = 0; i < nkeys; i++)
180 {
181 if (!check[i] || nullFlags[i])
182 {
183 res = false;
184 break;
185 }
186 }
187 break;
189
190 *recheck = true;
191
192 res = true;
193 break;
195
196 *recheck = true;
197
198
199
200
201
202
203 res = true;
204 for (i = 0; i < nkeys; i++)
205 {
206 if (!check[i])
207 {
208 res = false;
209 break;
210 }
211 }
212 break;
213 default:
214 elog(ERROR, "ginarrayconsistent: unknown strategy number: %d",
215 strategy);
216 res = false;
217 }
218
220}
#define PG_GETARG_POINTER(n)
#define PG_GETARG_UINT16(n)
#define PG_GETARG_INT32(n)
#define PG_RETURN_BOOL(x)
#define GinOverlapStrategy
#define GinContainedStrategy
#define GinContainsStrategy
References elog, ERROR, GinContainedStrategy, GinContainsStrategy, GinEqualStrategy, GinOverlapStrategy, i, PG_GETARG_INT32, PG_GETARG_POINTER, PG_GETARG_UINT16, and PG_RETURN_BOOL.
◆ ginarrayextract()
Definition at line 33 of file ginarrayproc.c.
34{
35
40 bool elmbyval;
41 char elmalign;
43 bool *nulls;
44 int nelems;
45
47 &elmlen, &elmbyval, &elmalign);
48
51 elmlen, elmbyval, elmalign,
52 &elems, &nulls, &nelems);
53
54 *nkeys = nelems;
55 *nullFlags = nulls;
56
57
59}
#define PG_GETARG_ARRAYTYPE_P_COPY(n)
void deconstruct_array(ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp)
#define PG_RETURN_POINTER(x)
void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, char *typalign)
References ARR_ELEMTYPE, deconstruct_array(), get_typlenbyvalalign(), PG_GETARG_ARRAYTYPE_P_COPY, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Referenced by ginarrayextract_2args().
◆ ginarrayextract_2args()
◆ ginarraytriconsistent()
Definition at line 226 of file ginarrayproc.c.
227{
230
231
233
234
235
239
240 switch (strategy)
241 {
243
245 for (i = 0; i < nkeys; i++)
246 {
247 if (!nullFlags[i])
248 {
250 {
252 break;
253 }
255 {
257 }
258 }
259 }
260 break;
262
264 for (i = 0; i < nkeys; i++)
265 {
266 if (check[i] == GIN_FALSE || nullFlags[i])
267 {
269 break;
270 }
272 {
274 }
275 }
276 break;
278
280 break;
282
283
284
285
286
287
289 for (i = 0; i < nkeys; i++)
290 {
292 {
294 break;
295 }
296 }
297 break;
298 default:
299 elog(ERROR, "ginarrayconsistent: unknown strategy number: %d",
300 strategy);
301 res = false;
302 }
303
305}
#define PG_RETURN_GIN_TERNARY_VALUE(x)
References elog, ERROR, GIN_FALSE, GIN_MAYBE, GIN_TRUE, GinContainedStrategy, GinContainsStrategy, GinEqualStrategy, GinOverlapStrategy, i, PG_GETARG_INT32, PG_GETARG_POINTER, PG_GETARG_UINT16, and PG_RETURN_GIN_TERNARY_VALUE.
◆ ginqueryarrayextract()
Definition at line 79 of file ginarrayproc.c.
80{
81
85
86
87
91 bool elmbyval;
92 char elmalign;
94 bool *nulls;
95 int nelems;
96
98 &elmlen, &elmbyval, &elmalign);
99
102 elmlen, elmbyval, elmalign,
103 &elems, &nulls, &nelems);
104
105 *nkeys = nelems;
106 *nullFlags = nulls;
107
108 switch (strategy)
109 {
112 break;
114 if (nelems > 0)
116 else
118 break;
120
122 break;
124 if (nelems > 0)
126 else
128 break;
129 default:
130 elog(ERROR, "ginqueryarrayextract: unknown strategy number: %d",
131 strategy);
132 }
133
134
136}
#define GIN_SEARCH_MODE_ALL
#define GIN_SEARCH_MODE_DEFAULT
#define GIN_SEARCH_MODE_INCLUDE_EMPTY
References ARR_ELEMTYPE, deconstruct_array(), elog, ERROR, get_typlenbyvalalign(), GIN_SEARCH_MODE_ALL, GIN_SEARCH_MODE_DEFAULT, GIN_SEARCH_MODE_INCLUDE_EMPTY, GinContainedStrategy, GinContainsStrategy, GinEqualStrategy, GinOverlapStrategy, PG_GETARG_ARRAYTYPE_P_COPY, PG_GETARG_POINTER, PG_GETARG_UINT16, and PG_RETURN_POINTER.