21 #define WAITOPERATOR 3
94 errmsg(
"operand syntax error")));
101 (
errcode(ERRCODE_SYNTAX_ERROR),
102 errmsg(
"modifiers syntax error")));
131 else if (*(
state->buf) ==
'\0')
145 state->buf += charlen;
162 if (distance > 0xffff)
164 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
165 errmsg(
"value is too big")));
168 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
169 errmsg(
"operand is too long")));
186 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
187 errmsg(
"word is too long")));
201 memcpy(
state->curop, strval, lenval);
202 state->curop += lenval;
203 *(
state->curop) =
'\0';
205 state->sumlen += lenval + 1;
209 #define STACKDEPTH 32
234 while (lenstack && (stack[lenstack - 1] == (
int32)
'&' ||
235 stack[lenstack - 1] == (
int32)
'!'))
253 stack[lenstack] =
val;
260 while (lenstack && (stack[lenstack - 1] == (
int32)
'&' ||
261 stack[lenstack - 1] == (
int32)
'!'))
283 (
errcode(ERRCODE_SYNTAX_ERROR),
308 else if (ptr[*pos].
val == (
int32)
'!')
316 ITEM *curitem = &ptr[*pos];
321 curitem->
left = *pos - tmp;
352 state.escontext = escontext;
358 *(
state.curop) =
'\0';
365 (
errcode(ERRCODE_SYNTAX_ERROR),
371 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
372 errmsg(
"ltxtquery is too large")));
437 elog(
ERROR,
"unsupported ltxtquery version number %d", version);
458 #define RESIZEBUF(inf,addsize) \
459 while( ( (inf)->cur - (inf)->buf ) + (addsize) + 1 >= (inf)->buflen ) \
461 int32 len = (inf)->cur - (inf)->buf; \
462 (inf)->buflen *= 2; \
463 (inf)->buf = (char*) repalloc( (void*)(inf)->buf, (inf)->buflen ); \
464 (inf)->cur = (inf)->buf + len; \
520 in->
cur = strchr(in->
cur,
'\0');
527 in->
cur = strchr(in->
cur,
'\0');
536 if (op == (
int32)
'|' && !first)
540 in->
cur = strchr(in->
cur,
'\0');
558 in->
cur = strchr(in->
cur,
'\0');
561 if (op == (
int32)
'|' && !first)
565 in->
cur = strchr(in->
cur,
'\0');
577 if (query->
size == 0)
579 (
errcode(ERRCODE_SYNTAX_ERROR),
610 if (query->
size == 0)
612 (
errcode(ERRCODE_SYNTAX_ERROR),
#define COMPUTESIZE(size)
unsigned int ltree_crc32_sz(const char *buf, int size)
static void PGresult * res
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define ereport(elevel,...)
#define PG_RETURN_BYTEA_P(x)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_POINTER(x)
#define PG_GETARG_LTXTQUERY_P(n)
#define LTXTQUERY_TOO_BIG(size, lenofoperand)
static int32 gettoken_query(QPRS_STATE *state, int32 *val, int32 *lenval, char **strval, uint16 *flag)
Datum ltxtq_recv(PG_FUNCTION_ARGS)
Datum ltxtq_send(PG_FUNCTION_ARGS)
static bool pushquery(QPRS_STATE *state, int32 type, int32 val, int32 distance, int32 lenval, uint16 flag)
static ltxtquery * queryin(char *buf, struct Node *escontext)
static int32 makepol(QPRS_STATE *state)
static bool pushval_asis(QPRS_STATE *state, int type, char *strval, int lenval, uint16 flag)
#define RESIZEBUF(inf, addsize)
static void findoprnd(ITEM *ptr, int32 *pos)
Datum ltxtq_out(PG_FUNCTION_ARGS)
static void infix(INFIX *in, bool first)
PG_FUNCTION_INFO_V1(ltxtq_in)
Datum ltxtq_in(PG_FUNCTION_ARGS)
int pg_mblen(const char *mbstr)
void pfree(void *pointer)
void * palloc0(Size size)
void * repalloc(void *pointer, Size size)
#define SOFT_ERROR_OCCURRED(escontext)
void check_stack_depth(void)
StringInfoData * StringInfo
int t_isspace(const char *ptr)
#define SET_VARSIZE(PTR, len)