1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-08 06:02:22 +03:00

Error message editing in contrib (mostly by Joe Conway --- thanks Joe!)

This commit is contained in:
Tom Lane
2003-07-24 17:52:50 +00:00
parent f0c5384d4a
commit 8fd5b3ed67
75 changed files with 1459 additions and 658 deletions

View File

@@ -3,14 +3,18 @@
-- does not depend on contents of seg.sql.
--
\set ECHO none
psql:tsearch.sql:9: NOTICE: ProcedureCreate: type txtidx is not yet defined
psql:tsearch.sql:14: NOTICE: Argument type "txtidx" is only a shell
psql:tsearch.sql:38: NOTICE: ProcedureCreate: type query_txt is not yet defined
psql:tsearch.sql:43: NOTICE: Argument type "query_txt" is only a shell
psql:tsearch.sql:55: NOTICE: ProcedureCreate: type mquery_txt is not yet defined
psql:tsearch.sql:61: NOTICE: Argument type "mquery_txt" is only a shell
psql:tsearch.sql:156: NOTICE: ProcedureCreate: type gtxtidx is not yet defined
psql:tsearch.sql:161: NOTICE: Argument type "gtxtidx" is only a shell
psql:tsearch.sql:9: NOTICE: type txtidx is not yet defined
DETAIL: Creating a shell type definition.
psql:tsearch.sql:14: NOTICE: argument type txtidx is only a shell
psql:tsearch.sql:38: NOTICE: type query_txt is not yet defined
DETAIL: Creating a shell type definition.
psql:tsearch.sql:43: NOTICE: argument type query_txt is only a shell
psql:tsearch.sql:55: NOTICE: type mquery_txt is not yet defined
DETAIL: Creating a shell type definition.
psql:tsearch.sql:61: NOTICE: argument type mquery_txt is only a shell
psql:tsearch.sql:156: NOTICE: type gtxtidx is not yet defined
DETAIL: Creating a shell type definition.
psql:tsearch.sql:161: NOTICE: argument type gtxtidx is only a shell
--txtidx
SELECT '1'::txtidx;
txtidx

View File

@@ -5,8 +5,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"
@@ -60,14 +58,18 @@ Datum gtxtidx_picksplit(PG_FUNCTION_ARGS);
Datum
gtxtidx_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "Not implemented");
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("gtxtidx_in not implemented")));
PG_RETURN_DATUM(0);
}
Datum
gtxtidx_out(PG_FUNCTION_ARGS)
{
elog(ERROR, "Not implemented");
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("gtxtidx_out not implemented")));
PG_RETURN_DATUM(0);
}

View File

@@ -15,8 +15,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"
@@ -129,7 +127,9 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval)
return VAL;
}
else
elog(ERROR, "No operand");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("no operand")));
}
break;
case WAITOPERATOR:
@@ -171,9 +171,13 @@ pushquery(QPRS_STATE * state, int4 type, int4 val, int4 distance, int4 lenval)
tmp->type = type;
tmp->val = val;
if (distance > 0xffff)
elog(ERROR, "Value is too big");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("value is too big")));
if (lenval > 0xffff)
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;
@@ -188,7 +192,9 @@ static void
pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval)
{
if (lenval > 0xffff)
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);
@@ -226,7 +232,9 @@ pushval_morph(QPRS_STATE * state, int typeval, char *strval, int lenval)
if (tokenlen > 0xffff)
{
end_parse();
elog(ERROR, "Word is too long");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("word is too long")));
}
lenlemm = tokenlen;
lemm = lemmatize(token, &lenlemm, type);
@@ -278,7 +286,8 @@ makepol(QPRS_STATE * state, void (*pushval) (QPRS_STATE *, int, char *, int))
else
{
if (lenstack == STACKDEPTH)
elog(ERROR, "Stack too short");
/* internal error */
elog(ERROR, "stack too short");
stack[lenstack] = val;
lenstack++;
}
@@ -303,7 +312,10 @@ makepol(QPRS_STATE * state, void (*pushval) (QPRS_STATE *, int, char *, int))
break;
case ERR:
default:
elog(ERROR, "Syntax error");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error")));
return ERR;
}
@@ -450,7 +462,7 @@ findoprnd(ITEM * ptr, int4 *pos)
{
#ifdef BS_DEBUG
elog(DEBUG4, (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)
{
@@ -517,7 +529,9 @@ queryin(char *buf, void (*pushval) (QPRS_STATE *, int, char *, int))
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);

View File

@@ -8,8 +8,6 @@
#include "access/gist.h"
#include "access/itup.h"
#include "utils/elog.h"
#include "utils/palloc.h"
#include "utils/builtins.h"
#include "storage/bufpage.h"
#include "executor/spi.h"
@@ -128,7 +126,9 @@ gettoken_txtidx(TI_IN_STATE * state)
oldstate = WAITENDWORD;
}
else if (state->oprisdelim && ISOPERATOR(*(state->prsbuf)))
elog(ERROR, "Syntax error");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error")));
else if (*(state->prsbuf) != ' ')
{
*(state->curpos) = *(state->prsbuf);
@@ -139,7 +139,9 @@ gettoken_txtidx(TI_IN_STATE * state)
else if (state->state == WAITNEXTCHAR)
{
if (*(state->prsbuf) == '\0')
elog(ERROR, "There is no escaped character");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("there is no escaped character")));
else
{
RESIZEPRSBUF;
@@ -160,7 +162,9 @@ gettoken_txtidx(TI_IN_STATE * state)
{
RESIZEPRSBUF;
if (state->curpos == state->word)
elog(ERROR, "Syntax error");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error")));
*(state->curpos) = '\0';
return 1;
}
@@ -178,7 +182,9 @@ gettoken_txtidx(TI_IN_STATE * state)
RESIZEPRSBUF;
*(state->curpos) = '\0';
if (state->curpos == state->word)
elog(ERROR, "Syntax error");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error")));
state->prsbuf++;
return 1;
}
@@ -188,7 +194,9 @@ gettoken_txtidx(TI_IN_STATE * state)
oldstate = WAITENDCMPLX;
}
else if (*(state->prsbuf) == '\0')
elog(ERROR, "Syntax error");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error")));
else
{
RESIZEPRSBUF;
@@ -197,7 +205,8 @@ gettoken_txtidx(TI_IN_STATE * state)
}
}
else
elog(ERROR, "Inner bug :(");
/* internal error */
elog(ERROR, "internal error");
state->prsbuf++;
}
@@ -241,10 +250,14 @@ txtidx_in(PG_FUNCTION_ARGS)
cur = tmpbuf + dist;
}
if (state.curpos - state.word > 0xffff)
elog(ERROR, "Word is too long");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("word is too long")));
arr[len].len = state.curpos - state.word;
if (cur - tmpbuf > 0xffff)
elog(ERROR, "Too long value");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("too long value")));
arr[len].pos = cur - tmpbuf;
memcpy((void *) cur, (void *) state.word, arr[len].len);
cur += arr[len].len;
@@ -253,7 +266,9 @@ txtidx_in(PG_FUNCTION_ARGS)
pfree(state.word);
if (!len)
elog(ERROR, "Void value");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("void value")));
len = uniqueentry(arr, len, tmpbuf, &buflen);
totallen = CALCDATASIZE(len, buflen);
@@ -359,7 +374,9 @@ parsetext(PRSTEXT * prs, char *buf, int4 buflen)
if (tokenlen > 0xffff)
{
end_parse();
elog(ERROR, "Word is too long");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("word is too long")));
}
lenlemm = tokenlen;
@@ -461,7 +478,9 @@ makevalue(PRSTEXT * prs)
{
ptr->len = prs->words[i].len;
if (cur - str > 0xffff)
elog(ERROR, "Value is too big");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("value is too big")));
ptr->pos = cur - str;
ptr++;
memcpy((void *) cur, (void *) prs->words[i].word, prs->words[i].len);
@@ -512,12 +531,15 @@ tsearch(PG_FUNCTION_ARGS)
Datum datum = (Datum) 0;
if (!CALLED_AS_TRIGGER(fcinfo))
/* internal error */
elog(ERROR, "TSearch: Not fired by trigger manager");
trigdata = (TriggerData *) fcinfo->context;
if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
/* internal error */
elog(ERROR, "TSearch: Can't process STATEMENT events");
if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
/* internal error */
elog(ERROR, "TSearch: Must be fired BEFORE event");
if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event))
@@ -525,18 +547,21 @@ tsearch(PG_FUNCTION_ARGS)
else if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
rettuple = trigdata->tg_newtuple;
else
/* internal error */
elog(ERROR, "TSearch: Unknown event");
trigger = trigdata->tg_trigger;
rel = trigdata->tg_relation;
if (trigger->tgnargs < 2)
/* internal error */
elog(ERROR, "TSearch: format tsearch(txtidx_field, text_field1,...)");
numidxattr = SPI_fnumber(rel->rd_att, trigger->tgargs[0]);
if (numidxattr == SPI_ERROR_NOATTRIBUTE)
elog(ERROR, "TSearch: Can not find txtidx_field");
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("could not find txtidx_field")));
prs.lenwords = 32;
prs.curwords = 0;
prs.words = (WORD *) palloc(sizeof(WORD) * prs.lenwords);
@@ -594,6 +619,7 @@ tsearch(PG_FUNCTION_ARGS)
}
if (rettuple == NULL)
/* internal error */
elog(ERROR, "TSearch: %d returned by SPI_modifytuple", SPI_result);
return PointerGetDatum(rettuple);