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) if (get_func_rettype(handlerOid) != INDEX_AM_HANDLEROID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE), (errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("function %s must return type \"%s\"", errmsg("function %s must return type %s",
NameListToString(handler_name), NameListToString(handler_name),
"index_am_handler"))); "index_am_handler")));
break; break;

View File

@ -85,7 +85,7 @@ CreateConversionCommand(CreateConversionStmt *stmt)
if (get_func_rettype(funcoid) != VOIDOID) if (get_func_rettype(funcoid) != VOIDOID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (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"))); NameListToString(func_name), "void")));
/* Check we have EXECUTE rights for the function */ /* Check we have EXECUTE rights for the function */

View File

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

View File

@ -486,7 +486,7 @@ lookup_fdw_handler_func(DefElem *handler)
if (get_func_rettype(handlerOid) != FDW_HANDLEROID) if (get_func_rettype(handlerOid) != FDW_HANDLEROID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE), (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"))); NameListToString((List *) handler->arg), "fdw_handler")));
return handlerOid; return handlerOid;

View File

@ -275,7 +275,7 @@ ValidateRestrictionEstimator(List *restrictionName)
if (get_func_rettype(restrictionOid) != FLOAT8OID) if (get_func_rettype(restrictionOid) != FLOAT8OID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (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"))); NameListToString(restrictionName), "float8")));
/* Require EXECUTE rights for the estimator */ /* Require EXECUTE rights for the estimator */
@ -321,7 +321,7 @@ ValidateJoinEstimator(List *joinName)
if (get_func_rettype(joinOid) != FLOAT8OID) if (get_func_rettype(joinOid) != FLOAT8OID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (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"))); NameListToString(joinName), "float8")));
/* Require EXECUTE rights for the estimator */ /* Require EXECUTE rights for the estimator */

View File

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

View File

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

View File

@ -450,14 +450,14 @@ DefineType(List *names, List *parameters)
{ {
/* backwards-compatibility hack */ /* backwards-compatibility hack */
ereport(WARNING, 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))); NameListToString(inputName), "opaque", typeName)));
SetFunctionReturnType(inputOid, typoid); SetFunctionReturnType(inputOid, typoid);
} }
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (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))); NameListToString(inputName), typeName)));
} }
resulttype = get_func_rettype(outputOid); resulttype = get_func_rettype(outputOid);
@ -467,14 +467,14 @@ DefineType(List *names, List *parameters)
{ {
/* backwards-compatibility hack */ /* backwards-compatibility hack */
ereport(WARNING, 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"))); NameListToString(outputName), "opaque", "cstring")));
SetFunctionReturnType(outputOid, CSTRINGOID); SetFunctionReturnType(outputOid, CSTRINGOID);
} }
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (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"))); NameListToString(outputName), "cstring")));
} }
if (receiveOid) if (receiveOid)
@ -483,7 +483,7 @@ DefineType(List *names, List *parameters)
if (resulttype != typoid) if (resulttype != typoid)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (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))); NameListToString(receiveName), typeName)));
} }
if (sendOid) if (sendOid)
@ -492,7 +492,7 @@ DefineType(List *names, List *parameters)
if (resulttype != BYTEAOID) if (resulttype != BYTEAOID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (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"))); NameListToString(sendName), "bytea")));
} }
@ -1834,7 +1834,7 @@ findTypeTypmodinFunction(List *procname)
if (get_func_rettype(procOid) != INT4OID) if (get_func_rettype(procOid) != INT4OID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (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"))); NameListToString(procname), "integer")));
return procOid; return procOid;
@ -1861,7 +1861,7 @@ findTypeTypmodoutFunction(List *procname)
if (get_func_rettype(procOid) != CSTRINGOID) if (get_func_rettype(procOid) != CSTRINGOID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (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"))); NameListToString(procname), "cstring")));
return procOid; return procOid;
@ -1888,7 +1888,7 @@ findTypeAnalyzeFunction(List *procname, Oid typeOid)
if (get_func_rettype(procOid) != BOOLOID) if (get_func_rettype(procOid) != BOOLOID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (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"))); NameListToString(procname), "boolean")));
return procOid; return procOid;
@ -2007,7 +2007,7 @@ findRangeSubtypeDiffFunction(List *procname, Oid subtype)
if (get_func_rettype(procOid) != FLOAT8OID) if (get_func_rettype(procOid) != FLOAT8OID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (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), func_signature_string(procname, 2, NIL, argList),
"double precision"))); "double precision")));

View File

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

View File

@ -2,7 +2,7 @@
create event trigger regress_event_trigger create event trigger regress_event_trigger
on ddl_command_start on ddl_command_start
execute procedure pg_backend_pid(); 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 -- OK
create function test_event_trigger() returns event_trigger as $$ create function test_event_trigger() returns event_trigger as $$
BEGIN BEGIN