mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Error message editing in contrib (mostly by Joe Conway --- thanks Joe!)
This commit is contained in:
@ -16,8 +16,6 @@
|
||||
#include "access/gist.h"
|
||||
#include "access/itup.h"
|
||||
#include "access/rtree.h"
|
||||
#include "utils/elog.h"
|
||||
#include "utils/palloc.h"
|
||||
#include "utils/array.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "storage/bufpage.h"
|
||||
@ -149,7 +147,9 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, int2
|
||||
(state->buf)++;
|
||||
return OPEN;
|
||||
} else if ( *(state->buf) == ':' ) {
|
||||
elog(ERROR,"Error at start of operand");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("error at start of operand")));
|
||||
} else if (*(state->buf) != ' ') {
|
||||
state->valstate.prsbuf = state->buf;
|
||||
state->state = WAITOPERATOR;
|
||||
@ -161,7 +161,9 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, int2
|
||||
return VAL;
|
||||
}
|
||||
else
|
||||
elog(ERROR, "No operand");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("no operand")));
|
||||
}
|
||||
break;
|
||||
case WAITOPERATOR:
|
||||
@ -204,9 +206,13 @@ pushquery(QPRS_STATE * state, int4 type, int4 val, int4 distance, int4 lenval, i
|
||||
tmp->type = type;
|
||||
tmp->val = val;
|
||||
if (distance >= MAXSTRPOS)
|
||||
elog(ERROR, "Value is too big");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("value is too big")));
|
||||
if (lenval >= MAXSTRLEN)
|
||||
elog(ERROR, "Operand is too long");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("operand is too long")));
|
||||
tmp->distance = distance;
|
||||
tmp->length = lenval;
|
||||
tmp->next = state->str;
|
||||
@ -221,7 +227,9 @@ static void
|
||||
pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, int2 weight)
|
||||
{
|
||||
if (lenval >= MAXSTRLEN)
|
||||
elog(ERROR, "Word is too long");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("word is too long")));
|
||||
|
||||
pushquery(state, type, crc32_sz((uint8 *) strval, lenval),
|
||||
state->curop - state->op, lenval, weight);
|
||||
@ -305,7 +313,8 @@ makepol(QPRS_STATE * state, void (*pushval) (QPRS_STATE *, int, char *, int, int
|
||||
else
|
||||
{
|
||||
if (lenstack == STACKDEPTH)
|
||||
elog(ERROR, "Stack too short");
|
||||
/* internal error */
|
||||
elog(ERROR, "stack too short");
|
||||
stack[lenstack] = val;
|
||||
lenstack++;
|
||||
}
|
||||
@ -330,7 +339,9 @@ makepol(QPRS_STATE * state, void (*pushval) (QPRS_STATE *, int, char *, int, int
|
||||
break;
|
||||
case ERR:
|
||||
default:
|
||||
elog(ERROR, "Syntax error");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("syntax error")));
|
||||
return ERR;
|
||||
|
||||
}
|
||||
@ -493,7 +504,7 @@ findoprnd(ITEM * ptr, int4 *pos)
|
||||
{
|
||||
#ifdef BS_DEBUG
|
||||
elog(DEBUG3, (ptr[*pos].type == OPR) ?
|
||||
"%d %c" : "%d %d ", *pos, ptr[*pos].val);
|
||||
"%d %c" : "%d %d", *pos, ptr[*pos].val);
|
||||
#endif
|
||||
if (ptr[*pos].type == VAL || ptr[*pos].type == VALTRUE)
|
||||
{
|
||||
@ -561,7 +572,9 @@ queryin(char *buf, void (*pushval) (QPRS_STATE *, int, char *, int, int2), int c
|
||||
makepol(&state, pushval);
|
||||
pfree(state.valstate.word);
|
||||
if (!state.num)
|
||||
elog(ERROR, "Empty query");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("empty query")));
|
||||
|
||||
/* make finish struct */
|
||||
commonlen = COMPUTESIZE(state.num, state.sumlen);
|
||||
|
Reference in New Issue
Block a user