159{
162
163
164
165 bool prefix;
167
168
169
170
171
173 length:12,
174 distance:20;
176
177
178
179
180
181#define OP_NOT 1
182#define OP_AND 2
183#define OP_OR 3
184#define OP_PHRASE 4
185#define OP_COUNT 4
186
188
189
190#define OP_PRIORITY(x) ( tsearch_op_priority[(x) - 1] )
191
192#define QO_PRIORITY(x) OP_PRIORITY(((QueryOperator *) (x))->oper)
193
194typedef struct
195{
200
201
203
204
205
206
207
208typedef union
209{
214
215
216
217
218
219
220typedef struct
221{
226
228
229#define HDRSIZETQ ( VARHDRSZ + sizeof(int32) )
230
231
232
233
234#define COMPUTESIZE(size, lenofoperand) ( HDRSIZETQ + (size) * sizeof(QueryItem) + (lenofoperand) )
235#define TSQUERY_TOO_BIG(size, lenofoperand) \
236 ((size) > (MaxAllocSize - HDRSIZETQ - (lenofoperand)) / sizeof(QueryItem))
237
238
239#define GETQUERY(x) ((QueryItem*)( (char*)(x)+HDRSIZETQ ))
240
241
242#define GETOPERAND(x) ( (char*)GETQUERY(x) + ((TSQuery)(x))->size * sizeof(QueryItem) )
243
244
245
246
247
248
249
252{
254}
255
258{
260}
261
264{
266}
267
268#define PG_GETARG_TSQUERY(n) DatumGetTSQuery(PG_GETARG_DATUM(n))
269#define PG_GETARG_TSQUERY_COPY(n) DatumGetTSQueryCopy(PG_GETARG_DATUM(n))
270#define PG_RETURN_TSQUERY(x) return TSQueryGetDatum(x)
271
272#endif
#define FLEXIBLE_ARRAY_MEMBER
#define PG_DETOAST_DATUM_COPY(datum)
Operator oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId, bool noError, int location)
static Datum PointerGetDatum(const void *X)
static Pointer DatumGetPointer(Datum X)
static TSQuery DatumGetTSQuery(Datum X)
PGDLLIMPORT const int tsearch_op_priority[OP_COUNT]
static TSQuery DatumGetTSQueryCopy(Datum X)
static Datum TSQueryGetDatum(const TSQueryData *X)