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

@ -44,7 +44,7 @@ box:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("bad cube representation"),
errdetail("different point dimensions in (%s) and (%s)",
errdetail("Different point dimensions in (%s) and (%s).",
$2, $4)));
YYABORT;
}
@ -52,8 +52,8 @@ box:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("bad cube representation"),
errdetail("more than %d dimensions",
CUBE_MAX_DIM)));
errdetail("A cube cannot have more than %d dimensions.",
CUBE_MAX_DIM)));
YYABORT;
}
@ -70,7 +70,7 @@ box:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("bad cube representation"),
errdetail("different point dimensions in (%s) and (%s)",
errdetail("Different point dimensions in (%s) and (%s).",
$1, $3)));
YYABORT;
}
@ -78,7 +78,7 @@ box:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("bad cube representation"),
errdetail("more than %d dimensions",
errdetail("A cube cannot have more than %d dimensions.",
CUBE_MAX_DIM)));
YYABORT;
}
@ -95,7 +95,7 @@ box:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("bad cube representation"),
errdetail("more than %d dimensions",
errdetail("A cube cannot have more than %d dimensions.",
CUBE_MAX_DIM)));
YYABORT;
}
@ -113,7 +113,7 @@ box:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("bad cube representation"),
errdetail("more than %d dimensions",
errdetail("A cube cannot have more than %d dimensions.",
CUBE_MAX_DIM)));
YYABORT;
}
@ -187,7 +187,8 @@ write_box(unsigned int dim, char *str1, char *str2)
}
static NDBOX * write_point_as_box(char *str, int dim)
static NDBOX *
write_point_as_box(char *str, int dim)
{
NDBOX * bp;
int i, size;

View File

@ -144,7 +144,7 @@ g_int_compress(PG_FUNCTION_ARGS)
PREPAREARR(r);
if (ARRNELEMS(r) >= 2 * MAXNUMRANGE)
elog(NOTICE, "Input array is too big (%d maximum allowed, %d current), use gist__intbig_ops opclass instead",
elog(NOTICE, "input array is too big (%d maximum allowed, %d current), use gist__intbig_ops opclass instead",
2 * MAXNUMRANGE - 1, ARRNELEMS(r));
retval = palloc(sizeof(GISTENTRY));

View File

@ -1,7 +1,7 @@
/*
* PostgreSQL type definitions for ISBNs.
*
* $PostgreSQL: pgsql/contrib/isbn_issn/isbn_issn.c,v 1.7 2003/11/29 22:39:20 pgsql Exp $
* $PostgreSQL: pgsql/contrib/isbn_issn/isbn_issn.c,v 1.8 2006/03/01 06:30:31 neilc Exp $
*/
#include "postgres.h"
@ -45,28 +45,23 @@ isbn *
isbn_in(char *str)
{
isbn *result;
int len;
if (strlen(str) != 13)
{
len = strlen(str);
if (len != 13)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid ISBN: \"%s\"", str),
errdetail("incorrect length")));
errdetail("ISBNs must be 13 characters in length.")));
return (NULL);
}
if (isbn_sum(str) != 0)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid ISBN: \"%s\"", str),
errdetail("failed checksum")));
return (NULL);
}
errdetail("ISBN failed checksum.")));
result = (isbn *) palloc(sizeof(isbn));
strncpy(result->num, str, 13);
memcpy(result->num, str, len);
memset(result->pad, ' ', 3);
return (result);
}
@ -239,28 +234,23 @@ issn *
issn_in(char *str)
{
issn *result;
int len;
if (strlen(str) != 9)
{
len = strlen(str);
if (len != 9)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid ISSN: \"%s\"", str),
errdetail("incorrect length")));
errdetail("ISSNs must be 9 characters in length.")));
return (NULL);
}
if (issn_sum(str) != 0)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid ISSN: \"%s\"", str),
errdetail("failed checksum")));
return (NULL);
}
errdetail("ISSN failed checksum.")));
result = (issn *) palloc(sizeof(issn));
strncpy(result->num, str, 9);
memcpy(result->num, str, len);
memset(result->pad, ' ', 7);
return (result);
}

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;

View File

@ -60,14 +60,14 @@ static const uint8 number_of_ones[256] = {
Datum
gtrgm_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "Not implemented");
elog(ERROR, "not implemented");
PG_RETURN_DATUM(0);
}
Datum
gtrgm_out(PG_FUNCTION_ARGS)
{
elog(ERROR, "Not implemented");
elog(ERROR, "not implemented");
PG_RETURN_DATUM(0);
}

View File

@ -13,7 +13,7 @@ set_limit(PG_FUNCTION_ARGS)
float4 nlimit = PG_GETARG_FLOAT4(0);
if (nlimit < 0 || nlimit > 1.0)
elog(ERROR, "Wrong limit, should be between 0 and 1");
elog(ERROR, "wrong limit, should be between 0 and 1");
trgm_limit = nlimit;
PG_RETURN_FLOAT4(trgm_limit);
}

View File

@ -894,9 +894,9 @@ get_crosstab_tuplestore(char *sql,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid return type"),
errdetail("query-specified return " \
errdetail("Query-specified return " \
"tuple has %d columns but crosstab " \
"returns %d", tupdesc->natts, result_ncols)));
"returns %d.", tupdesc->natts, result_ncols)));
/* allocate space */
values = (char **) palloc(result_ncols * sizeof(char *));
@ -1531,12 +1531,12 @@ validateConnectbyTupleDesc(TupleDesc tupdesc, bool show_branch, bool show_serial
/* check that the type of the fifth column is INT4 */
if (show_branch && show_serial && tupdesc->attrs[4]->atttypid != INT4OID)
elog(ERROR, "Query-specified return tuple not valid for Connectby: "
elog(ERROR, "query-specified return tuple not valid for Connectby: "
"fifth column must be type %s", format_type_be(INT4OID));
/* check that the type of the fifth column is INT4 */
if (!show_branch && show_serial && tupdesc->attrs[3]->atttypid != INT4OID)
elog(ERROR, "Query-specified return tuple not valid for Connectby: "
elog(ERROR, "query-specified return tuple not valid for Connectby: "
"fourth column must be type %s", format_type_be(INT4OID));
/* OK, the tupdesc is valid for our purposes */

View File

@ -322,7 +322,7 @@ result, and a NOTICE like this:</p>
<pre>
SELECT to_tsquery('default', 'a|is&amp;not|!the');
NOTICE: Query contains only stopword(s)
or doesn't contain lexem(s), ignored
or doesn't contain lexeme(s), ignored
to_tsquery
-----------
(1 row)
@ -730,7 +730,7 @@ the ISpell sources, and you can use them to integrate into
tsearch2. This is not complicated, but is not very obvious to begin
with. The tsearch2 ISpell interface needs only the listing of
dictionary words, it will parse and load those words, and use the
ISpell dictionary for lexem processing.</p>
ISpell dictionary for lexeme processing.</p>
<p>I found the ISPell make system to be very finicky. Their
documentation actually states this to be the case. So I just did
@ -769,7 +769,7 @@ to the stored procedures from the row where the dict_name =
WHERE dict_name = 'ispell_template');
</pre>
<p>Now that we have a dictionary we can specify it's use in a query
to get a lexem. For this we will use the lexize function. The
to get a lexeme. For this we will use the lexize function. The
lexize function takes the name of the dictionary to use as an
argument. Just as the other tsearch2 functions operate. You will
need to stop your psql session and start it again in order for this
@ -788,8 +788,8 @@ dictionary.</p>
<pre>
SELECT set_curdict('en_ispell');
</pre>
<p>Lexize is meant to turn a word into a lexem. It is possible to
receive more than one lexem returned for a single word.</p>
<p>Lexize is meant to turn a word into a lexeme. It is possible to
receive more than one lexeme returned for a single word.</p>
<pre>
SELECT lexize('en_ispell', 'conditionally');
lexize
@ -798,7 +798,7 @@ receive more than one lexem returned for a single word.</p>
(1 row)
</pre>
<p>The lexize function is not meant to take a full string as an
argument to return lexems for. If you passed in an entire sentence,
argument to return lexemes for. If you passed in an entire sentence,
it attempts to find that entire sentence in the dictionary. Since
the dictionary contains only words, you will receive an empty
result set back.</p>
@ -809,7 +809,7 @@ result set back.</p>
(1 row)
If you parse a lexem from a word not in the dictionary, then you will receive an empty result. This makes sense because the word "tsearch" is not in the english dictionary. You can create your own additions to the dictionary if you like. This may be useful for scientific or technical glossaries that need to be indexed. SELECT lexize('en_ispell', 'tsearch'); lexize -------- (1 row)
If you parse a lexeme from a word not in the dictionary, then you will receive an empty result. This makes sense because the word "tsearch" is not in the english dictionary. You can create your own additions to the dictionary if you like. This may be useful for scientific or technical glossaries that need to be indexed. SELECT lexize('en_ispell', 'tsearch'); lexize -------- (1 row)
</pre>
<p>This is not to say that tsearch will be ignored when adding text
@ -830,11 +830,11 @@ concerned with forcing the use of the ISpell dictionary.</p>
VALUES ('default_english', 'lword', '{en_ispell,en_stem}');
</pre>
<p>We have just inserted 3 records to the configuration mapping,
specifying that the lexem types for "lhword, lpart_hword and lword"
specifying that the lexeme types for "lhword, lpart_hword and lword"
are to be stemmed using the 'en_ispell' dictionary we added into
pg_ts_dict, when using the configuration ' default_english' which
we added to pg_ts_cfg.</p>
<p>There are several other lexem types used that we do not need to
<p>There are several other lexeme types used that we do not need to
specify as using the ISpell dictionary. We can simply insert values
using the 'simple' stemming process dictionary.</p>
<pre>
@ -889,10 +889,10 @@ configuration to be our default for en_US locale.</p>
(1 row)
</pre>
<p>Notice here that words like "tsearch" are still parsed and
indexed in the tsvector column. There is a lexem returned for the
indexed in the tsvector column. There is a lexeme returned for the
word becuase in the configuration mapping table, we specify words
to be used from the 'en_ispell' dictionary first, but as a fallback
to use the 'en_stem' dictionary. Therefore a lexem is not returned
to use the 'en_stem' dictionary. Therefore a lexeme is not returned
from en_ispell, but is returned from en_stem, and added to the
tsvector.</p>
<pre>
@ -905,7 +905,7 @@ tsvector.</p>
<p>Notice in this last example I added the word "computer" to the
text to be converted into a tsvector. Because we have setup our
default configuration to use the ISpell english dictionary, the
words are lexized, and computer returns 2 lexems at the same
words are lexized, and computer returns 2 lexemes at the same
position. 'compute':7 and 'computer':7 are now both indexed for the
word computer.</p>
<p>You can create additional dictionary lists, or use the extra

View File

@ -251,7 +251,7 @@ and give you an error to prevent this mistake:
<pre>
=# <b>SELECT to_tsquery('the')</b>
NOTICE: Query contains only stopword(s) or doesn't contain lexem(s), ignored
NOTICE: Query contains only stopword(s) or doesn't contain lexeme(s), ignored
to_tsquery
------------

View File

@ -869,7 +869,7 @@ CheckAffix(const char *word, size_t len, AFFIX * Affix, char flagflags, char *ne
char regerrstr[ERRSTRSIZE];
pg_regerror(err, &(Affix->reg.regex), regerrstr, ERRSTRSIZE);
elog(ERROR, "Regex error in '%s': %s", Affix->mask, regerrstr);
elog(ERROR, "regex error in '%s': %s", Affix->mask, regerrstr);
}
Affix->compile = 0;
}

View File

@ -74,7 +74,7 @@ parse_cfgdict(text *in, Map ** m)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error"),
errdetail("Syntax error in position %d",
errdetail("Syntax error in position %d.",
(int) (ptr - VARDATA(in)))));
}
else if (state == CS_INKEY)
@ -93,7 +93,7 @@ parse_cfgdict(text *in, Map ** m)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error"),
errdetail("Syntax error in position %d",
errdetail("Syntax error in position %d.",
(int) (ptr - VARDATA(in)))));
}
else if (state == CS_WAITEQ)
@ -104,7 +104,7 @@ parse_cfgdict(text *in, Map ** m)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error"),
errdetail("Syntax error in position %d",
errdetail("Syntax error in position %d.",
(int) (ptr - VARDATA(in)))));
}
else if (state == CS_WAITVALUE)
@ -150,7 +150,7 @@ parse_cfgdict(text *in, Map ** m)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error"),
errdetail("Syntax error in position %d",
errdetail("Syntax error in position %d.",
(int) (ptr - VARDATA(in)))));
}
else if (state == CS_INESC)
@ -161,7 +161,7 @@ parse_cfgdict(text *in, Map ** m)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("bad parser state"),
errdetail("%d at position %d",
errdetail("%d at position %d.",
state, (int) (ptr - VARDATA(in)))));
ptr+=pg_mblen(ptr);
}

View File

@ -643,7 +643,7 @@ static QUERYTYPE *
pfree(state.valstate.word);
if (!state.num)
{
elog(NOTICE, "Query doesn't contain lexem(s)");
elog(NOTICE, "query doesn't contain lexeme(s)");
query = (QUERYTYPE *) palloc(HDRSIZEQT);
query->len = HDRSIZEQT;
query->size = 0;

View File

@ -246,7 +246,7 @@ clean_fakeval_v2(ITEM * ptr, int4 *len)
resroot = clean_fakeval_intree(root, &result);
if (result != V_UNKNOWN)
{
elog(NOTICE, "Query contains only stopword(s) or doesn't contain lexem(s), ignored");
elog(NOTICE, "query contains only stopword(s) or doesn't contain lexeme(s), ignored");
*len = 0;
return NULL;
}

View File

@ -138,14 +138,14 @@ Datum gtsq_picksplit(PG_FUNCTION_ARGS);
Datum
gtsq_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "Not implemented");
elog(ERROR, "not implemented");
PG_RETURN_DATUM(0);
}
Datum
gtsq_out(PG_FUNCTION_ARGS)
{
elog(ERROR, "Not implemented");
elog(ERROR, "not implemented");
PG_RETURN_DATUM(0);
}

View File

@ -220,7 +220,7 @@ get_tsq_Oid(void)
if (SPI_processed < 0)
/* internal error */
elog(ERROR, "There is no tsvector type");
elog(ERROR, "there is no tsvector type");
tsqOid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull));
if (tsqOid == InvalidOid)
/* internal error */

View File

@ -318,7 +318,7 @@ parsetext_v2(TSCfgInfo * cfg, PRSTEXT * prs, char *buf, int4 buflen)
#endif
}
if (type >= cfg->len) /* skip this type of lexem */
if (type >= cfg->len) /* skip this type of lexeme */
continue;
for (i = 0; i < cfg->map[type].len; i++)
@ -335,7 +335,7 @@ parsetext_v2(TSCfgInfo * cfg, PRSTEXT * prs, char *buf, int4 buflen)
PointerGetDatum(lenlemm)
)
);
if (!norms) /* dictionary doesn't know this lexem */
if (!norms) /* dictionary doesn't know this lexeme */
continue;
prs->pos++; /* set pos */
@ -357,7 +357,7 @@ parsetext_v2(TSCfgInfo * cfg, PRSTEXT * prs, char *buf, int4 buflen)
prs->curwords++;
}
pfree(norms);
break; /* lexem already normalized or is stop word */
break; /* lexeme already normalized or is stop word */
}
}
@ -472,7 +472,7 @@ hlparsetext(TSCfgInfo * cfg, HLPRSTEXT * prs, QUERYTYPE * query, char *buf, int4
PointerGetDatum(lenlemm)
)
);
if (!norms) /* dictionary doesn't know this lexem */
if (!norms) /* dictionary doesn't know this lexeme */
continue;
while (ptr->lexeme)
@ -482,7 +482,7 @@ hlparsetext(TSCfgInfo * cfg, HLPRSTEXT * prs, QUERYTYPE * query, char *buf, int4
ptr++;
}
pfree(norms);
break; /* lexem already normalized or is stop word */
break; /* lexeme already normalized or is stop word */
}
}

View File

@ -426,7 +426,7 @@ get_ti_Oid(void)
if (SPI_processed < 1)
/* internal error */
elog(ERROR, "There is no tsvector type");
elog(ERROR, "there is no tsvector type");
tiOid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull));
if (tiOid == InvalidOid)
/* internal error */

View File

@ -1,7 +1,7 @@
/*
* In/Out definitions for tsvector type
* Internal structure:
* string of values, array of position lexem in string and it's length
* string of values, array of position lexeme in string and it's length
* Teodor Sigaev <teodor@sigaev.ru>
*/
#include "postgres.h"

View File

@ -342,14 +342,14 @@ set_curprs_byname(PG_FUNCTION_ARGS)
typedef struct
{
int type;
char *lexem;
} LexemEntry;
char *lexeme;
} LexemeEntry;
typedef struct
{
int cur;
int len;
LexemEntry *list;
int cur;
int len;
LexemeEntry *list;
} PrsStorage;
@ -370,7 +370,7 @@ prs_setup_firstcall(FunctionCallInfo fcinfo, FuncCallContext *funcctx,
st = (PrsStorage *) palloc(sizeof(PrsStorage));
st->cur = 0;
st->len = 16;
st->list = (LexemEntry *) palloc(sizeof(LexemEntry) * st->len);
st->list = (LexemeEntry *) palloc(sizeof(LexemeEntry) * st->len);
prs->prs = (void *) DatumGetPointer(
FunctionCall2(
@ -390,11 +390,11 @@ prs_setup_firstcall(FunctionCallInfo fcinfo, FuncCallContext *funcctx,
if (st->cur >= st->len)
{
st->len = 2 * st->len;
st->list = (LexemEntry *) repalloc(st->list, sizeof(LexemEntry) * st->len);
st->list = (LexemeEntry *) repalloc(st->list, sizeof(LexemeEntry) * st->len);
}
st->list[st->cur].lexem = palloc(llen + 1);
memcpy(st->list[st->cur].lexem, lex, llen);
st->list[st->cur].lexem[llen] = '\0';
st->list[st->cur].lexeme = palloc(llen + 1);
memcpy(st->list[st->cur].lexeme, lex, llen);
st->list[st->cur].lexeme[llen] = '\0';
st->list[st->cur].type = type;
st->cur++;
}
@ -430,7 +430,7 @@ prs_process_call(FuncCallContext *funcctx)
values[0] = tid;
sprintf(tid, "%d", st->list[st->cur].type);
values[1] = st->list[st->cur].lexem;
values[1] = st->list[st->cur].lexeme;
tuple = BuildTupleFromCStrings(funcctx->attinmeta, values);
result = HeapTupleGetDatum(tuple);

View File

@ -600,7 +600,7 @@ pgxml_result_to_text(xmlXPathObjectPtr res,
break;
default:
elog(NOTICE, "Unsupported XQuery result: %d", res->type);
elog(NOTICE, "unsupported XQuery result: %d", res->type);
xpresstr = xmlStrdup("<unsupported/>");
}
@ -781,8 +781,8 @@ xpath_table(PG_FUNCTION_ARGS)
if (spi_tupdesc->natts != 2)
{
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("Expression returning multiple columns is not valid in parameter list"),
errdetail("Expected two columns in SPI result, got %d", spi_tupdesc->natts)));
errmsg("expression returning multiple columns is not valid in parameter list"),
errdetail("Expected two columns in SPI result, got %d.", spi_tupdesc->natts)));
}
/* Setup the parser. Beware that this must happen in the same context as the
@ -890,7 +890,7 @@ xpath_table(PG_FUNCTION_ARGS)
break;
default:
elog(NOTICE, "Unsupported XQuery result: %d", res->type);
elog(NOTICE, "unsupported XQuery result: %d", res->type);
resstr = xmlStrdup("<unsupported/>");
}

View File

@ -81,7 +81,7 @@ xslt_process(PG_FUNCTION_ARGS)
if (doctree == NULL)
{
xmlCleanupParser();
elog_error(ERROR, "Error parsing XML document", 0);
elog_error(ERROR, "error parsing XML document", 0);
PG_RETURN_NULL();
}
@ -95,7 +95,7 @@ xslt_process(PG_FUNCTION_ARGS)
{
xmlFreeDoc(doctree);
xmlCleanupParser();
elog_error(ERROR, "Error parsing stylesheet as XML document", 0);
elog_error(ERROR, "error parsing stylesheet as XML document", 0);
PG_RETURN_NULL();
}
@ -110,7 +110,7 @@ xslt_process(PG_FUNCTION_ARGS)
xmlFreeDoc(doctree);
xsltCleanupGlobals();
xmlCleanupParser();
elog_error(ERROR, "Failed to parse stylesheet", 0);
elog_error(ERROR, "failed to parse stylesheet", 0);
PG_RETURN_NULL();
}

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.49 2005/11/04 23:14:00 petere Exp $
$PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.50 2006/03/01 06:30:32 neilc Exp $
-->
<chapter id="plperl">
@ -399,7 +399,7 @@ CREATE OR REPLACE FUNCTION lotsa_md5 (INTEGER) RETURNS SETOF foo_type AS $$
my $t = localtime;
elog(NOTICE, "opening file $file at $t" );
open my $fh, '&lt;', $file # ooh, it's a file access!
or elog(ERROR, "Can't open $file for reading: $!");
or elog(ERROR, "can't open $file for reading: $!");
my @words = &lt;$fh&gt;;
close $fh;
$t = localtime;
@ -556,9 +556,9 @@ $$ LANGUAGE plperl;
CREATE FUNCTION badfunc() RETURNS integer AS $$
my $tmpfile = "/tmp/badfile";
open my $fh, '&gt;', $tmpfile
or elog(ERROR, qq{Could not open the file "$tmpfile": $!});
or elog(ERROR, qq{could not open the file "$tmpfile": $!});
print $fh "Testing writing to a file\n";
close $fh or elog(ERROR, qq{Could not close the file "$tmpfile": $!});
close $fh or elog(ERROR, qq{could not close the file "$tmpfile": $!});
return 1;
$$ LANGUAGE plperl;
</programlisting>

View File

@ -41,7 +41,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.34 2006/01/21 04:38:21 tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.35 2006/03/01 06:30:32 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -752,42 +752,41 @@ SlruReportIOError(SlruCtl ctl, int pageno, TransactionId xid)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not access status of transaction %u", xid),
errdetail("could not open file \"%s\": %m",
path)));
errdetail("Could not open file \"%s\": %m.", path)));
break;
case SLRU_SEEK_FAILED:
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not access status of transaction %u", xid),
errdetail("could not seek in file \"%s\" to offset %u: %m",
errdetail("Could not seek in file \"%s\" to offset %u: %m.",
path, offset)));
break;
case SLRU_READ_FAILED:
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not access status of transaction %u", xid),
errdetail("could not read from file \"%s\" at offset %u: %m",
errdetail("Could not read from file \"%s\" at offset %u: %m.",
path, offset)));
break;
case SLRU_WRITE_FAILED:
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not access status of transaction %u", xid),
errdetail("could not write to file \"%s\" at offset %u: %m",
errdetail("Could not write to file \"%s\" at offset %u: %m.",
path, offset)));
break;
case SLRU_FSYNC_FAILED:
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not access status of transaction %u", xid),
errdetail("could not fsync file \"%s\": %m",
errdetail("Could not fsync file \"%s\": %m.",
path)));
break;
case SLRU_CLOSE_FAILED:
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not access status of transaction %u", xid),
errdetail("could not close file \"%s\": %m",
errdetail("Could not close file \"%s\": %m.",
path)));
break;
default:

View File

@ -10,7 +10,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.44 2005/10/15 02:49:22 momjian Exp $
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.45 2006/03/01 06:30:32 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -426,7 +426,7 @@ PGSharedMemoryReAttach(void)
UsedShmemSegAddr = origUsedShmemSegAddr;
#endif
elog(DEBUG3, "Attaching to %p", UsedShmemSegAddr);
elog(DEBUG3, "attaching to %p", UsedShmemSegAddr);
hdr = (void *) PGSharedMemoryAttach((IpcMemoryKey) UsedShmemSegID, &shmid);
if (hdr == NULL)
elog(FATAL, "could not reattach to shared memory (key=%d, addr=%p): %m",

View File

@ -29,7 +29,7 @@
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.73 2006/02/28 20:56:14 neilc Exp $
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.74 2006/03/01 06:30:32 neilc Exp $
*
*********************************************************************
*/
@ -404,7 +404,7 @@ PLy_trigger_handler(FunctionCallInfo fcinfo, PLyProcedure * proc)
ereport(ERROR,
(errcode(ERRCODE_DATA_EXCEPTION),
errmsg("unexpected return value from trigger procedure"),
errdetail("expected None or a String")));
errdetail("Expected None or a String.")));
srv = PyString_AsString(plrv);
if (pg_strcasecmp(srv, "SKIP") == 0)
@ -428,7 +428,7 @@ PLy_trigger_handler(FunctionCallInfo fcinfo, PLyProcedure * proc)
ereport(ERROR,
(errcode(ERRCODE_DATA_EXCEPTION),
errmsg("unexpected return value from trigger procedure"),
errdetail("expected None, \"OK\", \"SKIP\", or \"MODIFY\"")));
errdetail("Expected None, \"OK\", \"SKIP\", or \"MODIFY\".")));
}
}
}
@ -770,7 +770,7 @@ PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure * proc)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("invalid return value from plpython function"),
errdetail("Functions returning type \"void\" must return \"None\".")));
errdetail("Functions returning type \"void\" must return None.")));
fcinfo->isnull = false;
rv = (Datum) 0;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/tutorial/beard.c,v 1.13 2005/10/15 02:49:52 momjian Exp $
* $PostgreSQL: pgsql/src/tutorial/beard.c,v 1.14 2006/03/01 06:30:32 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -38,10 +38,10 @@ beard(Oid picture)
ObjectIdGetDatum(picture),
Int32GetDatum(INV_READ)));
if (pic_fd < 0)
elog(ERROR, "Cannot access picture large object");
elog(ERROR, "could not access picture large object");
if (lo_read(pic_fd, (char *) &ihdr, sizeof(ihdr)) != sizeof(ihdr))
elog(ERROR, "Picture large object corrupted");
elog(ERROR, "picture large object corrupted");
beardOffset = (ihdr.size / 3) * 2;
@ -51,19 +51,19 @@ beard(Oid picture)
beard = DatumGetObjectId(DirectFunctionCall1(lo_creat,
Int32GetDatum(INV_MD)));
if (beard == InvalidOid)
elog(ERROR, "Cannot create new large object");
elog(ERROR, "could not create new large object");
beard_fd = DatumGetInt32(DirectFunctionCall2(lo_open,
ObjectIdGetDatum(beard),
Int32GetDatum(INV_WRITE)));
if (beard_fd < 0)
elog(ERROR, "Cannot access beard large object");
elog(ERROR, "could not access beard large object");
if (DatumGetInt32(DirectFunctionCall3(lo_lseek,
Int32GetDatum(pic_fd),
Int32GetDatum(beardOffset),
Int32GetDatum(SEEK_SET))) < 0)
elog(ERROR, "Cannot seek in picture large object");
elog(ERROR, "could not seek in picture large object");
while ((cc = lo_read(pic_fd, buf, BUFSIZE)) > 0)
{