]> granicus.if.org Git - postgresql/commitdiff
Type names should not be quoted
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 1 Apr 2016 16:35:48 +0000 (13:35 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 1 Apr 2016 16:35:48 +0000 (13:35 -0300)
Our actual convention, contrary to what I said in 59a2111b23f, 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

src/backend/commands/amcmds.c
src/backend/commands/conversioncmds.c
src/backend/commands/event_trigger.c
src/backend/commands/foreigncmds.c
src/backend/commands/operatorcmds.c
src/backend/commands/proclang.c
src/backend/commands/trigger.c
src/backend/commands/typecmds.c
src/backend/parser/parse_clause.c
src/test/regress/expected/event_trigger.out

index 68ea5f3c58326f47efc08fea76b845132d7cb588..904dc1cbd19b748c1c95b26b49cdaaa1f190c2ad 100644 (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;
index a5a63f45754575983cc947977f1b4d69f0de2d1e..ad9b8ba156ce5db7a090ac1cba6806376adb097a 100644 (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 */
index 3735d44ee9d0b89f35ca8e8fb00b1a8dbbaa6362..50c89b827b2dc5f7d3f2be6042833dcaa0f3d06b 100644 (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. */
index 72c819317e0081a4f52e1d6a2bf75af76be30bbd..804bab2e1f5cadd63cb737ebd551eee021dd128a 100644 (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;
index 6edbe85ef5328ad10bcf8afc9c37e6bee5399ad4..672f2eb212f5a95d84d9bcf0ab181b14cdb83350 100644 (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 */
index 43581ec310245b867aaf84090894cb2c997b9f39..0515f4d3df9df220400a927dc7ddfa1e3cfe2ffd 100644 (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")));
                }
 
index 5429aab1c152bf7f53d4413cce89d9b4950f90f8..6f728ff0fc9cd70ca963c8b8783d5f9a032ca75f 100644 (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")));
        }
 
index 3de29b766dea32293f1fdded61f327940381eab5..71d4df9c7977bbf1b9820a6dacd628de97366068 100644 (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")));
 
index 8dbe94374198dafdafd46867b0f0ddb2cef21969..c9edd881eef9de74963022d968f71921299a8982 100644 (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)));
 
index 87254ef8fe9e9782cbc383a120026957fdcfd412..ee68317e5dcecd60e5dcd67e9ee224986aea2ee5 100644 (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