1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

This patch makes the error message strings throughout the backend

more compliant with the error message style guide. In particular,
errdetail should begin with a capital letter and end with a period,
whereas errmsg should not. I also fixed a few related issues in
passing, such as fixing the repeated misspelling of "lexeme" in
contrib/tsearch2 (per Tom's suggestion).
This commit is contained in:
Neil Conway
2006-03-01 06:30:32 +00:00
parent 87fa10a426
commit 8e5a10d46c
30 changed files with 129 additions and 139 deletions

View File

@ -26,7 +26,7 @@ typedef struct
} FieldNot;
static char *
getlexem(char *start, char *end, int *len)
getlexeme(char *start, char *end, int *len)
{
char *ptr;
@ -45,7 +45,7 @@ getlexem(char *start, char *end, int *len)
}
bool
compare_subnode(ltree_level * t, char *qn, int len, int (*cmpptr) (const char *, const char *, size_t), bool anyend)
compare_subnode(ltree_level * t, char *qn, int len, int (*cmpptr) (const char *, const char *, size_t), bool anyend)
{
char *endt = t->name + t->len;
char *endq = qn + len;
@ -54,11 +54,11 @@ bool
lenq;
bool isok;
while ((qn = getlexem(qn, endq, &lenq)) != NULL)
while ((qn = getlexeme(qn, endq, &lenq)) != NULL)
{
tn = t->name;
isok = false;
while ((tn = getlexem(tn, endt, &lent)) != NULL)
while ((tn = getlexeme(tn, endt, &lent)) != NULL)
{
if (
(
@ -93,7 +93,7 @@ checkLevel(lquery_level * curq, ltree_level * curt)
{
cmpptr = (curvar->flag & LVAR_INCASE) ? pg_strncasecmp : strncmp;
if (curvar->flag & LVAR_SUBLEXEM)
if (curvar->flag & LVAR_SUBLEXEME)
{
if (compare_subnode(curt, curvar->name, curvar->len, cmpptr, (curvar->flag & LVAR_ANYEND)))
return true;

View File

@ -40,7 +40,7 @@ typedef struct
#define LVAR_ANYEND 0x01
#define LVAR_INCASE 0x02
#define LVAR_SUBLEXEM 0x04
#define LVAR_SUBLEXEME 0x04
typedef struct
{
@ -58,9 +58,9 @@ typedef struct
#define LQL_NOT 0x10
#ifdef LOWER_NODE
#define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEM ) ) == 0 )
#define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEME ) ) == 0 )
#else
#define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEM | LVAR_INCASE ) ) == 0 )
#define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEME | LVAR_INCASE ) ) == 0 )
#endif
#define LQL_CANLOOKSIGN(x) FLG_CANLOOKSIGN( ((lquery_level*)(x))->flag )

View File

@ -80,8 +80,8 @@ ltree_in(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_NAME_TOO_LONG),
errmsg("name of level is too long"),
errdetail("name length is %d, must " \
"be < 256, in position %d",
errdetail("Name length is %d, must "
"be < 256, in position %d.",
lptr->len, (int) (lptr->start - buf))));
totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
@ -104,8 +104,8 @@ ltree_in(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_NAME_TOO_LONG),
errmsg("name of level is too long"),
errdetail("name length is %d, must " \
"be < 256, in position %d",
errdetail("Name length is %d, must "
"be < 256, in position %d.",
lptr->len, (int) (lptr->start - buf))));
totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
@ -269,21 +269,21 @@ lquery_in(PG_FUNCTION_ARGS)
{
if (lptr->start == ptr)
UNCHAR;
lptr->flag |= LVAR_SUBLEXEM;
curqlevel->flag |= LVAR_SUBLEXEM;
lptr->flag |= LVAR_SUBLEXEME;
curqlevel->flag |= LVAR_SUBLEXEME;
}
else if (*ptr == '|')
{
lptr->len = ptr - lptr->start -
((lptr->flag & LVAR_SUBLEXEM) ? 1 : 0) -
((lptr->flag & LVAR_SUBLEXEME) ? 1 : 0) -
((lptr->flag & LVAR_INCASE) ? 1 : 0) -
((lptr->flag & LVAR_ANYEND) ? 1 : 0);
if (lptr->len > 255)
ereport(ERROR,
(errcode(ERRCODE_NAME_TOO_LONG),
errmsg("name of level is too long"),
errdetail("name length is %d, must " \
"be < 256, in position %d",
errdetail("Name length is %d, must "
"be < 256, in position %d.",
lptr->len, (int) (lptr->start - buf))));
state = LQPRS_WAITVAR;
@ -291,15 +291,15 @@ lquery_in(PG_FUNCTION_ARGS)
else if (*ptr == '.')
{
lptr->len = ptr - lptr->start -
((lptr->flag & LVAR_SUBLEXEM) ? 1 : 0) -
((lptr->flag & LVAR_SUBLEXEME) ? 1 : 0) -
((lptr->flag & LVAR_INCASE) ? 1 : 0) -
((lptr->flag & LVAR_ANYEND) ? 1 : 0);
if (lptr->len > 255)
ereport(ERROR,
(errcode(ERRCODE_NAME_TOO_LONG),
errmsg("name of level is too long"),
errdetail("name length is %d, must " \
"be < 256, in position %d",
errdetail("Name length is %d, must "
"be < 256, in position %d.",
lptr->len, (int) (lptr->start - buf))));
state = LQPRS_WAITLEVEL;
@ -398,7 +398,7 @@ lquery_in(PG_FUNCTION_ARGS)
errdetail("Unexpected end of line.")));
lptr->len = ptr - lptr->start -
((lptr->flag & LVAR_SUBLEXEM) ? 1 : 0) -
((lptr->flag & LVAR_SUBLEXEME) ? 1 : 0) -
((lptr->flag & LVAR_INCASE) ? 1 : 0) -
((lptr->flag & LVAR_ANYEND) ? 1 : 0);
if (lptr->len == 0)
@ -411,8 +411,8 @@ lquery_in(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_NAME_TOO_LONG),
errmsg("name of level is too long"),
errdetail("name length is %d, must " \
"be < 256, in position %d",
errdetail("Name length is %d, must "
"be < 256, in position %d.",
lptr->len, (int) (lptr->start - buf))));
}
else if (state == LQPRS_WAITOPEN)
@ -539,7 +539,7 @@ lquery_out(PG_FUNCTION_ARGS)
}
memcpy(ptr, curtlevel->name, curtlevel->len);
ptr += curtlevel->len;
if ((curtlevel->flag & LVAR_SUBLEXEM))
if ((curtlevel->flag & LVAR_SUBLEXEME))
{
*ptr = '%';
ptr++;

View File

@ -95,7 +95,7 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint1
(*lenval)++;
}
else if (*(state->buf) == '%')
*flag |= LVAR_SUBLEXEM;
*flag |= LVAR_SUBLEXEME;
else if (*(state->buf) == '@')
*flag |= LVAR_INCASE;
else if (*(state->buf) == '*')
@ -412,7 +412,7 @@ infix(INFIX * in, bool first)
op++;
in->cur++;
}
if (in->curpol->flag & LVAR_SUBLEXEM)
if (in->curpol->flag & LVAR_SUBLEXEME)
{
*(in->cur) = '%';
in->cur++;

View File

@ -57,7 +57,7 @@ checkcondition_str(void *checkval, ITEM * val)
cmpptr = (val->flag & LVAR_INCASE) ? pg_strncasecmp : strncmp;
while (tlen > 0)
{
if (val->flag & LVAR_SUBLEXEM)
if (val->flag & LVAR_SUBLEXEME)
{
if (compare_subnode(level, op, val->length, cmpptr, (val->flag & LVAR_ANYEND)))
return true;