typedef struct
{
- char *buf;
+ char *buffer; /* entire string we are scanning */
+ char *buf; /* current scan point */
int4 state;
int4 count;
/* reverse polish notation in list (for temprorary usage) */
{
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("error at start of operand")));
+ errmsg("error at start of operand in tsearch query: \"%s\"",
+ state->buffer)));
}
else if (!t_isspace(state->buf))
{
else
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("no operand")));
+ errmsg("no operand in tsearch query: \"%s\"",
+ state->buffer)));
}
break;
case WAITOPERATOR:
if (distance >= MAXSTRPOS)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("value is too big")));
+ errmsg("value is too big in tsearch query: \"%s\"",
+ state->buffer)));
if (lenval >= MAXSTRLEN)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("operand is too long")));
+ errmsg("operand is too long in tsearch query: \"%s\"",
+ state->buffer)));
tmp->distance = distance;
tmp->length = lenval;
tmp->next = state->str;
if (lenval >= MAXSTRLEN)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("word is too long")));
+ errmsg("word is too long in tsearch query: \"%s\"",
+ state->buffer)));
pushquery(state, type, crc32_sz(strval, lenval),
state->curop - state->op, lenval, weight);
default:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("syntax error")));
+ errmsg("syntax error in tsearch query: \"%s\"",
+ state->buffer)));
return ERR;
}
#endif
/* init state */
+ state.buffer = buf;
state.buf = buf;
state.state = (isplain) ? WAITSINGLEOPERAND : WAITFIRSTOPERAND;
state.count = 0;
pfree(state.valstate.word);
if (!state.num)
{
- elog(NOTICE, "query doesn't contain lexeme(s)");
+ ereport(NOTICE,
+ (errmsg("tsearch query doesn't contain lexeme(s): \"%s\"",
+ state.buffer)));
query = (QUERYTYPE *) palloc(HDRSIZEQT);
query->len = HDRSIZEQT;
query->size = 0;