Type names should not be quoted

Our actual convention, contrary to what I said in 59a2111b23, is not to
quote type names, as evidenced by unquoted use of format_type_be()
result value in error messages.  Remove quotes from recently tweaked
messages accordingly.

Per note from Tom Lane
This commit is contained in:
Alvaro Herrera 2016-04-01 13:35:48 -03:00
parent a067b50470
commit f402b99501
10 changed files with 21 additions and 21 deletions

View File

@ -260,7 +260,7 @@ lookup_index_am_handler_func(List *handler_name, char amtype)
if (get_func_rettype(handlerOid) != INDEX_AM_HANDLEROID)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("function %s must return type \"%s\"",
errmsg("function %s must return type %s",
NameListToString(handler_name),
"index_am_handler")));
break;

View File

@ -85,7 +85,7 @@ CreateConversionCommand(CreateConversionStmt *stmt)
if (get_func_rettype(funcoid) != VOIDOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("encoding conversion function %s must return type \"%s\"",
errmsg("encoding conversion function %s must return type %s",
NameListToString(func_name), "void")));
/* Check we have EXECUTE rights for the function */

View File

@ -237,7 +237,7 @@ CreateEventTrigger(CreateEventTrigStmt *stmt)
if (funcrettype != EVTTRIGGEROID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("function %s must return type \"%s\"",
errmsg("function %s must return type %s",
NameListToString(stmt->funcname), "event_trigger")));
/* Insert catalog entries. */

View File

@ -486,7 +486,7 @@ lookup_fdw_handler_func(DefElem *handler)
if (get_func_rettype(handlerOid) != FDW_HANDLEROID)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("function %s must return type \"%s\"",
errmsg("function %s must return type %s",
NameListToString((List *) handler->arg), "fdw_handler")));
return handlerOid;

View File

@ -275,7 +275,7 @@ ValidateRestrictionEstimator(List *restrictionName)
if (get_func_rettype(restrictionOid) != FLOAT8OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("restriction estimator function %s must return type \"%s\"",
errmsg("restriction estimator function %s must return type %s",
NameListToString(restrictionName), "float8")));
/* Require EXECUTE rights for the estimator */
@ -321,7 +321,7 @@ ValidateJoinEstimator(List *joinName)
if (get_func_rettype(joinOid) != FLOAT8OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("join estimator function %s must return type \"%s\"",
errmsg("join estimator function %s must return type %s",
NameListToString(joinName), "float8")));
/* Require EXECUTE rights for the estimator */

View File

@ -114,7 +114,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
if (funcrettype != LANGUAGE_HANDLEROID)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("function %s must return type \"%s\"",
errmsg("function %s must return type %s",
NameListToString(funcname), "language_handler")));
}
else
@ -285,7 +285,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
else
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("function %s must return type \"%s\"",
errmsg("function %s must return type %s",
NameListToString(stmt->plhandler), "language_handler")));
}

View File

@ -438,7 +438,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("function %s must return type \"%s\"",
errmsg("function %s must return type %s",
NameListToString(stmt->funcname), "trigger")));
}

View File

@ -450,14 +450,14 @@ DefineType(List *names, List *parameters)
{
/* backwards-compatibility hack */
ereport(WARNING,
(errmsg("changing return type of function %s from \"%s\" to \"%s\"",
(errmsg("changing return type of function %s from %s to %s",
NameListToString(inputName), "opaque", typeName)));
SetFunctionReturnType(inputOid, typoid);
}
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("type input function %s must return type \"%s\"",
errmsg("type input function %s must return type %s",
NameListToString(inputName), typeName)));
}
resulttype = get_func_rettype(outputOid);
@ -467,14 +467,14 @@ DefineType(List *names, List *parameters)
{
/* backwards-compatibility hack */
ereport(WARNING,
(errmsg("changing return type of function %s from \"%s\" to \"%s\"",
(errmsg("changing return type of function %s from %s to %s",
NameListToString(outputName), "opaque", "cstring")));
SetFunctionReturnType(outputOid, CSTRINGOID);
}
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("type output function %s must return type \"%s\"",
errmsg("type output function %s must return type %s",
NameListToString(outputName), "cstring")));
}
if (receiveOid)
@ -483,7 +483,7 @@ DefineType(List *names, List *parameters)
if (resulttype != typoid)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("type receive function %s must return type \"%s\"",
errmsg("type receive function %s must return type %s",
NameListToString(receiveName), typeName)));
}
if (sendOid)
@ -492,7 +492,7 @@ DefineType(List *names, List *parameters)
if (resulttype != BYTEAOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("type send function %s must return type \"%s\"",
errmsg("type send function %s must return type %s",
NameListToString(sendName), "bytea")));
}
@ -1834,7 +1834,7 @@ findTypeTypmodinFunction(List *procname)
if (get_func_rettype(procOid) != INT4OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("typmod_in function %s must return type \"%s\"",
errmsg("typmod_in function %s must return type %s",
NameListToString(procname), "integer")));
return procOid;
@ -1861,7 +1861,7 @@ findTypeTypmodoutFunction(List *procname)
if (get_func_rettype(procOid) != CSTRINGOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("typmod_out function %s must return type \"%s\"",
errmsg("typmod_out function %s must return type %s",
NameListToString(procname), "cstring")));
return procOid;
@ -1888,7 +1888,7 @@ findTypeAnalyzeFunction(List *procname, Oid typeOid)
if (get_func_rettype(procOid) != BOOLOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("type analyze function %s must return type \"%s\"",
errmsg("type analyze function %s must return type %s",
NameListToString(procname), "boolean")));
return procOid;
@ -2007,7 +2007,7 @@ findRangeSubtypeDiffFunction(List *procname, Oid subtype)
if (get_func_rettype(procOid) != FLOAT8OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("range subtype diff function %s must return type \"%s\"",
errmsg("range subtype diff function %s must return type %s",
func_signature_string(procname, 2, NIL, argList),
"double precision")));

View File

@ -758,7 +758,7 @@ transformRangeTableSample(ParseState *pstate, RangeTableSample *rts)
if (get_func_rettype(handlerOid) != TSM_HANDLEROID)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("function %s must return type \"%s\"",
errmsg("function %s must return type %s",
NameListToString(rts->method), "tsm_handler"),
parser_errposition(pstate, rts->location)));

View File

@ -2,7 +2,7 @@
create event trigger regress_event_trigger
on ddl_command_start
execute procedure pg_backend_pid();
ERROR: function pg_backend_pid must return type "event_trigger"
ERROR: function pg_backend_pid must return type event_trigger
-- OK
create function test_event_trigger() returns event_trigger as $$
BEGIN