mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
First bits of work on error message editing.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.279 2003/07/16 17:25:48 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.280 2003/07/18 23:20:32 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -3095,11 +3095,15 @@ check_parameter_resolution_walker(Node *node,
|
||||
|
||||
if (paramno <= 0 || /* shouldn't happen, but... */
|
||||
paramno > context->numParams)
|
||||
elog(ERROR, "Parameter '$%d' is out of range", paramno);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_PARAMETER),
|
||||
errmsg("there is no parameter $%d", paramno)));
|
||||
|
||||
if (param->paramtype != context->paramTypes[paramno-1])
|
||||
elog(ERROR, "Could not determine datatype of parameter $%d",
|
||||
paramno);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_AMBIGUOUS_PARAMETER),
|
||||
errmsg("could not determine datatype of parameter $%d",
|
||||
paramno)));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.103 2003/07/03 19:07:48 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.104 2003/07/18 23:20:32 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -228,7 +228,9 @@ coerce_type(ParseState *pstate, Node *node,
|
||||
|
||||
if (paramno <= 0 || /* shouldn't happen, but... */
|
||||
paramno > toppstate->p_numparams)
|
||||
elog(ERROR, "Parameter '$%d' is out of range", paramno);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_PARAMETER),
|
||||
errmsg("there is no parameter $%d", paramno)));
|
||||
|
||||
if (toppstate->p_paramtypes[paramno-1] == UNKNOWNOID)
|
||||
{
|
||||
@@ -242,11 +244,13 @@ coerce_type(ParseState *pstate, Node *node,
|
||||
else
|
||||
{
|
||||
/* Ooops */
|
||||
elog(ERROR, "Inconsistent types deduced for parameter '$%d'"
|
||||
"\n\tCould be either %s or %s",
|
||||
paramno,
|
||||
format_type_be(toppstate->p_paramtypes[paramno-1]),
|
||||
format_type_be(targetTypeId));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_AMBIGUOUS_PARAMETER),
|
||||
errmsg("inconsistent types deduced for parameter $%d",
|
||||
paramno),
|
||||
errdetail("Could be either %s or %s.",
|
||||
format_type_be(toppstate->p_paramtypes[paramno-1]),
|
||||
format_type_be(targetTypeId))));
|
||||
}
|
||||
|
||||
param->paramtype = targetTypeId;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.155 2003/07/03 16:34:16 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.156 2003/07/18 23:20:32 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -128,13 +128,16 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||
|
||||
/* Check parameter number is in range */
|
||||
if (paramno <= 0) /* probably can't happen? */
|
||||
elog(ERROR, "Parameter '$%d' is out of range",
|
||||
paramno);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_PARAMETER),
|
||||
errmsg("there is no parameter $%d", paramno)));
|
||||
if (paramno > toppstate->p_numparams)
|
||||
{
|
||||
if (!toppstate->p_variableparams)
|
||||
elog(ERROR, "Parameter '$%d' is out of range",
|
||||
paramno);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_PARAMETER),
|
||||
errmsg("there is no parameter $%d",
|
||||
paramno)));
|
||||
/* Okay to enlarge param array */
|
||||
if (toppstate->p_paramtypes)
|
||||
toppstate->p_paramtypes =
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.153 2003/07/04 02:51:33 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.154 2003/07/18 23:20:32 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -84,15 +84,15 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
|
||||
* function, but the test doesn't hurt.
|
||||
*/
|
||||
if (nargs > FUNC_MAX_ARGS)
|
||||
elog(ERROR, "Cannot pass more than %d arguments to a function",
|
||||
FUNC_MAX_ARGS);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
|
||||
errmsg("cannot pass more than %d arguments to a function",
|
||||
FUNC_MAX_ARGS)));
|
||||
|
||||
if (fargs)
|
||||
{
|
||||
first_arg = lfirst(fargs);
|
||||
if (first_arg == NULL) /* should not happen */
|
||||
elog(ERROR, "Function '%s' does not allow NULL input",
|
||||
NameListToString(funcname));
|
||||
Assert(first_arg != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -179,7 +179,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
|
||||
case RTE_RELATION:
|
||||
toid = get_rel_type_id(rte->relid);
|
||||
if (!OidIsValid(toid))
|
||||
elog(ERROR, "Cannot find type OID for relation %u",
|
||||
elog(ERROR, "cannot find type OID for relation %u",
|
||||
rte->relid);
|
||||
/* replace RangeVar in the arg list */
|
||||
lfirst(i) = makeVar(vnum,
|
||||
@@ -219,8 +219,10 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
|
||||
unknown_attribute(schemaname, relname,
|
||||
strVal(lfirst(funcname)));
|
||||
else
|
||||
elog(ERROR, "Cannot pass result of sub-select or join %s to a function",
|
||||
relname);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot pass result of sub-select or join %s to a function",
|
||||
relname)));
|
||||
toid = InvalidOid; /* keep compiler quiet */
|
||||
break;
|
||||
}
|
||||
@@ -258,11 +260,16 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
|
||||
* an aggregate?
|
||||
*/
|
||||
if (agg_star)
|
||||
elog(ERROR, "%s(*) specified, but %s is not an aggregate function",
|
||||
NameListToString(funcname), NameListToString(funcname));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("%s(*) specified, but %s is not an aggregate function",
|
||||
NameListToString(funcname),
|
||||
NameListToString(funcname))));
|
||||
if (agg_distinct)
|
||||
elog(ERROR, "DISTINCT specified, but %s is not an aggregate function",
|
||||
NameListToString(funcname));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("DISTINCT specified, but %s is not an aggregate function",
|
||||
NameListToString(funcname))));
|
||||
}
|
||||
else if (fdresult != FUNCDETAIL_AGGREGATE)
|
||||
{
|
||||
@@ -284,11 +291,15 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
|
||||
colname);
|
||||
relTypeId = exprType(first_arg);
|
||||
if (!ISCOMPLEX(relTypeId))
|
||||
elog(ERROR, "Attribute notation .%s applied to type %s, which is not a complex type",
|
||||
colname, format_type_be(relTypeId));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("attribute notation .%s applied to type %s, which is not a complex type",
|
||||
colname, format_type_be(relTypeId))));
|
||||
else
|
||||
elog(ERROR, "Attribute \"%s\" not found in datatype %s",
|
||||
colname, format_type_be(relTypeId));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_COLUMN),
|
||||
errmsg("attribute \"%s\" not found in datatype %s",
|
||||
colname, format_type_be(relTypeId))));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -302,7 +313,6 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
|
||||
actual_arg_types)),
|
||||
errhint("Unable to choose a best candidate function. "
|
||||
"You may need to add explicit typecasts.")));
|
||||
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_FUNCTION),
|
||||
@@ -356,7 +366,9 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
|
||||
retval = (Node *) aggref;
|
||||
|
||||
if (retset)
|
||||
elog(ERROR, "Aggregates may not return sets");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
|
||||
errmsg("aggregates may not return sets")));
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -921,7 +933,7 @@ func_get_detail(List *funcname,
|
||||
ObjectIdGetDatum(best_candidate->oid),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(ftup)) /* should not happen */
|
||||
elog(ERROR, "cache lookup of function %u failed",
|
||||
elog(ERROR, "cache lookup failed for function %u",
|
||||
best_candidate->oid);
|
||||
pform = (Form_pg_proc) GETSTRUCT(ftup);
|
||||
*rettype = pform->prorettype;
|
||||
@@ -1249,8 +1261,10 @@ setup_field_select(Node *input, char *attname, Oid relid)
|
||||
|
||||
attno = get_attnum(relid, attname);
|
||||
if (attno == InvalidAttrNumber)
|
||||
elog(ERROR, "Relation \"%s\" has no column \"%s\"",
|
||||
get_rel_name(relid), attname);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_COLUMN),
|
||||
errmsg("relation \"%s\" has no column \"%s\"",
|
||||
get_rel_name(relid), attname)));
|
||||
|
||||
fselect->arg = (Expr *) input;
|
||||
fselect->fieldnum = attno;
|
||||
@@ -1323,18 +1337,22 @@ ParseComplexProjection(char *funcname, Node *first_arg)
|
||||
}
|
||||
|
||||
/*
|
||||
* Simple helper routine for delivering "No such attribute" error message
|
||||
* Simple helper routine for delivering "no such attribute" error message
|
||||
*/
|
||||
static void
|
||||
unknown_attribute(const char *schemaname, const char *relname,
|
||||
const char *attname)
|
||||
{
|
||||
if (schemaname)
|
||||
elog(ERROR, "No such attribute %s.%s.%s",
|
||||
schemaname, relname, attname);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_COLUMN),
|
||||
errmsg("no such attribute %s.%s.%s",
|
||||
schemaname, relname, attname)));
|
||||
else
|
||||
elog(ERROR, "No such attribute %s.%s",
|
||||
relname, attname);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_COLUMN),
|
||||
errmsg("no such attribute %s.%s",
|
||||
relname, attname)));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1389,11 +1407,16 @@ find_aggregate_func(List *aggname, Oid basetype, bool noError)
|
||||
if (noError)
|
||||
return InvalidOid;
|
||||
if (basetype == ANYOID)
|
||||
elog(ERROR, "aggregate %s(*) does not exist",
|
||||
NameListToString(aggname));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_FUNCTION),
|
||||
errmsg("aggregate %s(*) does not exist",
|
||||
NameListToString(aggname))));
|
||||
else
|
||||
elog(ERROR, "aggregate %s(%s) does not exist",
|
||||
NameListToString(aggname), format_type_be(basetype));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_FUNCTION),
|
||||
errmsg("aggregate %s(%s) does not exist",
|
||||
NameListToString(aggname),
|
||||
format_type_be(basetype))));
|
||||
}
|
||||
|
||||
/* Make sure it's an aggregate */
|
||||
@@ -1401,7 +1424,7 @@ find_aggregate_func(List *aggname, Oid basetype, bool noError)
|
||||
ObjectIdGetDatum(oid),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(ftup)) /* should not happen */
|
||||
elog(ERROR, "function %u not found", oid);
|
||||
elog(ERROR, "cache lookup failed for function %u", oid);
|
||||
pform = (Form_pg_proc) GETSTRUCT(ftup);
|
||||
|
||||
if (!pform->proisagg)
|
||||
@@ -1410,8 +1433,10 @@ find_aggregate_func(List *aggname, Oid basetype, bool noError)
|
||||
if (noError)
|
||||
return InvalidOid;
|
||||
/* we do not use the (*) notation for functions... */
|
||||
elog(ERROR, "function %s(%s) is not an aggregate",
|
||||
NameListToString(aggname), format_type_be(basetype));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("function %s(%s) is not an aggregate",
|
||||
NameListToString(aggname), format_type_be(basetype))));
|
||||
}
|
||||
|
||||
ReleaseSysCache(ftup);
|
||||
@@ -1445,8 +1470,10 @@ LookupFuncName(List *funcname, int nargs, const Oid *argtypes, bool noError)
|
||||
}
|
||||
|
||||
if (!noError)
|
||||
elog(ERROR, "function %s does not exist",
|
||||
func_signature_string(funcname, nargs, argtypes));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_FUNCTION),
|
||||
errmsg("function %s does not exist",
|
||||
func_signature_string(funcname, nargs, argtypes))));
|
||||
|
||||
return InvalidOid;
|
||||
}
|
||||
@@ -1466,8 +1493,10 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, bool noError)
|
||||
MemSet(argoids, 0, FUNC_MAX_ARGS * sizeof(Oid));
|
||||
argcount = length(argtypes);
|
||||
if (argcount > FUNC_MAX_ARGS)
|
||||
elog(ERROR, "functions cannot have more than %d arguments",
|
||||
FUNC_MAX_ARGS);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
|
||||
errmsg("functions cannot have more than %d arguments",
|
||||
FUNC_MAX_ARGS)));
|
||||
|
||||
for (i = 0; i < argcount; i++)
|
||||
{
|
||||
@@ -1476,8 +1505,10 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, bool noError)
|
||||
argoids[i] = LookupTypeName(t);
|
||||
|
||||
if (!OidIsValid(argoids[i]))
|
||||
elog(ERROR, "Type \"%s\" does not exist",
|
||||
TypeNameToString(t));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
errmsg("type \"%s\" does not exist",
|
||||
TypeNameToString(t))));
|
||||
|
||||
argtypes = lnext(argtypes);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.69 2003/07/04 02:51:33 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.70 2003/07/18 23:20:32 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -107,8 +107,10 @@ LookupOperNameTypeNames(List *opername, TypeName *oprleft,
|
||||
{
|
||||
leftoid = LookupTypeName(oprleft);
|
||||
if (!OidIsValid(leftoid))
|
||||
elog(ERROR, "type %s does not exist",
|
||||
TypeNameToString(oprleft));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
errmsg("type %s does not exist",
|
||||
TypeNameToString(oprleft))));
|
||||
}
|
||||
if (oprright == NULL)
|
||||
rightoid = InvalidOid;
|
||||
@@ -116,8 +118,10 @@ LookupOperNameTypeNames(List *opername, TypeName *oprleft,
|
||||
{
|
||||
rightoid = LookupTypeName(oprright);
|
||||
if (!OidIsValid(rightoid))
|
||||
elog(ERROR, "type %s does not exist",
|
||||
TypeNameToString(oprright));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
errmsg("type %s does not exist",
|
||||
TypeNameToString(oprright))));
|
||||
}
|
||||
|
||||
return LookupOperName(opername, leftoid, rightoid, noError);
|
||||
@@ -178,8 +182,10 @@ equality_oper(Oid argtype, bool noError)
|
||||
}
|
||||
}
|
||||
if (!noError)
|
||||
elog(ERROR, "unable to identify an equality operator for type %s",
|
||||
format_type_be(argtype));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_FUNCTION),
|
||||
errmsg("unable to identify an equality operator for type %s",
|
||||
format_type_be(argtype))));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -239,9 +245,11 @@ ordering_oper(Oid argtype, bool noError)
|
||||
}
|
||||
}
|
||||
if (!noError)
|
||||
elog(ERROR, "unable to identify an ordering operator for type %s"
|
||||
"\n\tUse an explicit ordering operator or modify the query",
|
||||
format_type_be(argtype));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_FUNCTION),
|
||||
errmsg("unable to identify an ordering operator for type %s",
|
||||
format_type_be(argtype)),
|
||||
errhint("Use an explicit ordering operator or modify the query.")));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -483,8 +491,10 @@ compatible_oper(List *op, Oid arg1, Oid arg2, bool noError)
|
||||
ReleaseSysCache(optup);
|
||||
|
||||
if (!noError)
|
||||
elog(ERROR, "operator requires run-time type coercion: %s",
|
||||
op_signature_string(op, 'b', arg1, arg2));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_FUNCTION),
|
||||
errmsg("operator requires run-time type coercion: %s",
|
||||
op_signature_string(op, 'b', arg1, arg2))));
|
||||
|
||||
return (Operator) NULL;
|
||||
}
|
||||
@@ -773,7 +783,9 @@ make_scalar_array_op(ParseState *pstate, List *opname,
|
||||
{
|
||||
rtypeId = get_element_type(atypeId);
|
||||
if (!OidIsValid(rtypeId))
|
||||
elog(ERROR, "op ANY/ALL (array) requires array on right side");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("op ANY/ALL (array) requires array on right side")));
|
||||
}
|
||||
|
||||
/* Now resolve the operator */
|
||||
@@ -800,9 +812,13 @@ make_scalar_array_op(ParseState *pstate, List *opname,
|
||||
* Check that operator result is boolean
|
||||
*/
|
||||
if (rettype != BOOLOID)
|
||||
elog(ERROR, "op ANY/ALL (array) requires operator to yield boolean");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("op ANY/ALL (array) requires operator to yield boolean")));
|
||||
if (get_func_retset(opform->oprcode))
|
||||
elog(ERROR, "op ANY/ALL (array) requires operator not to return a set");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("op ANY/ALL (array) requires operator not to return a set")));
|
||||
|
||||
/*
|
||||
* Now switch back to the array type on the right, arranging for
|
||||
@@ -810,8 +826,10 @@ make_scalar_array_op(ParseState *pstate, List *opname,
|
||||
*/
|
||||
res_atypeId = get_array_type(declared_arg_types[1]);
|
||||
if (!OidIsValid(res_atypeId))
|
||||
elog(ERROR, "unable to find datatype for array of %s",
|
||||
format_type_be(declared_arg_types[1]));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
errmsg("unable to find datatype for array of %s",
|
||||
format_type_be(declared_arg_types[1]))));
|
||||
actual_arg_types[1] = atypeId;
|
||||
declared_arg_types[1] = res_atypeId;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.108 2003/06/19 23:22:40 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.109 2003/07/18 23:20:32 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -403,8 +403,10 @@ other .
|
||||
|
||||
len = pg_mbcliplen(literalbuf, literallen,
|
||||
NAMEDATALEN-1);
|
||||
elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"",
|
||||
literalbuf, len, literalbuf);
|
||||
ereport(NOTICE,
|
||||
(errcode(ERRCODE_NAME_TOO_LONG),
|
||||
errmsg("identifier \"%s\" will be truncated to \"%.*s\"",
|
||||
literalbuf, len, literalbuf)));
|
||||
literalbuf[len] = '\0';
|
||||
literallen = len;
|
||||
}
|
||||
@@ -559,8 +561,10 @@ other .
|
||||
int len;
|
||||
|
||||
len = pg_mbcliplen(ident, i, NAMEDATALEN-1);
|
||||
elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"",
|
||||
ident, len, ident);
|
||||
ereport(NOTICE,
|
||||
(errcode(ERRCODE_NAME_TOO_LONG),
|
||||
errmsg("identifier \"%s\" will be truncated to \"%.*s\"",
|
||||
ident, len, ident)));
|
||||
ident[len] = '\0';
|
||||
}
|
||||
yylval.str = ident;
|
||||
@@ -582,16 +586,18 @@ yyerror(const char *message)
|
||||
|
||||
if (*loc == YY_END_OF_BUFFER_CHAR)
|
||||
{
|
||||
/* translator: %s is typically "syntax error" */
|
||||
ereport(ERROR,
|
||||
(errmsg("%s at end of input", message),
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
/* translator: %s is typically "syntax error" */
|
||||
errmsg("%s at end of input", message),
|
||||
errposition(cursorpos)));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* translator: first %s is typically "syntax error" */
|
||||
ereport(ERROR,
|
||||
(errmsg("%s at or near \"%s\"", message, loc),
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
/* translator: first %s is typically "syntax error" */
|
||||
errmsg("%s at or near \"%s\"", message, loc),
|
||||
errposition(cursorpos)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user