91 else if (!isspace((
unsigned char) *
state->buf))
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;
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;
347 state.escontext = escontext;
353 *(
state.curop) =
'\0';
360 (
errcode(ERRCODE_SYNTAX_ERROR),
366 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
367 errmsg(
"ltxtquery is too large")));
432 elog(
ERROR,
"unsupported ltxtquery version number %d", version);
453#define RESIZEBUF(inf,addsize) \
454while( ( (inf)->cur - (inf)->buf ) + (addsize) + 1 >= (inf)->buflen ) \
456 int32 len = (inf)->cur - (inf)->buf; \
457 (inf)->buflen *= 2; \
458 (inf)->buf = (char*) repalloc( (void*)(inf)->buf, (inf)->buflen ); \
459 (inf)->cur = (inf)->buf + len; \
515 in->
cur = strchr(in->
cur,
'\0');
522 in->
cur = strchr(in->
cur,
'\0');
531 if (op == (
int32)
'|' && !first)
535 in->
cur = strchr(in->
cur,
'\0');
553 in->
cur = strchr(in->
cur,
'\0');
556 if (op == (
int32)
'|' && !first)
560 in->
cur = strchr(in->
cur,
'\0');
572 if (query->
size == 0)
574 (
errcode(ERRCODE_SYNTAX_ERROR),
605 if (query->
size == 0)
607 (
errcode(ERRCODE_SYNTAX_ERROR),
#define COMPUTESIZE(size)
unsigned int ltree_crc32_sz(const char *buf, int size)
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define ereport(elevel,...)
#define palloc_object(type)
#define palloc_array(type, count)
#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 ltxtquery * queryin(char *buf, struct Node *escontext)
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 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 * repalloc(void *pointer, Size size)
void pfree(void *pointer)
void * palloc0(Size size)
#define SOFT_ERROR_OCCURRED(escontext)
static char buf[DEFAULT_XLOG_SEG_SIZE]
void check_stack_depth(void)
struct StringInfoData * StringInfo
static void SET_VARSIZE(void *PTR, Size len)