Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit59a2111

Browse files
committed
Improve internationalization of messages involving type names
Change the slightly different variations of the message function FOO must return type BARto a single wording, removing the variability in type name so that theyall create a single translation entry; since the type name is not to betranslated, there's no point in it being part of the message anyway.Also, change them all to use the same quoting convention, namely thatthe function name is not to be quoted but the type name is. (I'm notquite sure why this is so, but it's the clear majority.)Some similar messages such as "encoding conversion function FOO must ..."are also changed.
1 parent559e7a0 commit59a2111

File tree

8 files changed

+37
-36
lines changed

8 files changed

+37
-36
lines changed

‎src/backend/commands/conversioncmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ CreateConversionCommand(CreateConversionStmt *stmt)
8585
if (get_func_rettype(funcoid)!=VOIDOID)
8686
ereport(ERROR,
8787
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
88-
errmsg("encoding conversion function %s must return type \"void\"",
89-
NameListToString(func_name))));
88+
errmsg("encoding conversion function %s must return type \"%s\"",
89+
NameListToString(func_name),"void")));
9090

9191
/* Check we have EXECUTE rights for the function */
9292
aclresult=pg_proc_aclcheck(funcoid,GetUserId(),ACL_EXECUTE);

‎src/backend/commands/event_trigger.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ CreateEventTrigger(CreateEventTrigStmt *stmt)
237237
if (funcrettype!=EVTTRIGGEROID)
238238
ereport(ERROR,
239239
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
240-
errmsg("function\"%s\" must return type \"event_trigger\"",
241-
NameListToString(stmt->funcname))));
240+
errmsg("function%s must return type \"%s\"",
241+
NameListToString(stmt->funcname),"event_trigger")));
242242

243243
/* Insert catalog entries. */
244244
returninsert_event_trigger_tuple(stmt->trigname,stmt->eventname,

‎src/backend/commands/foreigncmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,8 @@ lookup_fdw_handler_func(DefElem *handler)
486486
if (get_func_rettype(handlerOid)!=FDW_HANDLEROID)
487487
ereport(ERROR,
488488
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
489-
errmsg("function %s must return type \"fdw_handler\"",
490-
NameListToString((List*)handler->arg))));
489+
errmsg("function %s must return type \"%s\"",
490+
NameListToString((List*)handler->arg),"fdw_handler")));
491491

492492
returnhandlerOid;
493493
}

‎src/backend/commands/operatorcmds.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ ValidateRestrictionEstimator(List *restrictionName)
275275
if (get_func_rettype(restrictionOid)!=FLOAT8OID)
276276
ereport(ERROR,
277277
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
278-
errmsg("restriction estimator function %s must return type \"float8\"",
279-
NameListToString(restrictionName))));
278+
errmsg("restriction estimator function %s must return type \"%s\"",
279+
NameListToString(restrictionName),"float8")));
280280

281281
/* Require EXECUTE rights for the estimator */
282282
aclresult=pg_proc_aclcheck(restrictionOid,GetUserId(),ACL_EXECUTE);
@@ -321,8 +321,8 @@ ValidateJoinEstimator(List *joinName)
321321
if (get_func_rettype(joinOid)!=FLOAT8OID)
322322
ereport(ERROR,
323323
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
324-
errmsg("join estimator function %s must return type \"float8\"",
325-
NameListToString(joinName))));
324+
errmsg("join estimator function %s must return type \"%s\"",
325+
NameListToString(joinName),"float8")));
326326

327327
/* Require EXECUTE rights for the estimator */
328328
aclresult=pg_proc_aclcheck(joinOid,GetUserId(),ACL_EXECUTE);

‎src/backend/commands/proclang.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
114114
if (funcrettype!=LANGUAGE_HANDLEROID)
115115
ereport(ERROR,
116116
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
117-
errmsg("function %s must return type \"language_handler\"",
118-
NameListToString(funcname))));
117+
errmsg("function %s must return type \"%s\"",
118+
NameListToString(funcname),"language_handler")));
119119
}
120120
else
121121
{
@@ -285,8 +285,8 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
285285
else
286286
ereport(ERROR,
287287
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
288-
errmsg("function %s must return type \"language_handler\"",
289-
NameListToString(stmt->plhandler))));
288+
errmsg("function %s must return type \"%s\"",
289+
NameListToString(stmt->plhandler),"language_handler")));
290290
}
291291

292292
/* validate the inline function */

‎src/backend/commands/trigger.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,8 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
438438
else
439439
ereport(ERROR,
440440
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
441-
errmsg("function %s must return type \"trigger\"",
442-
NameListToString(stmt->funcname))));
441+
errmsg("function %s must return type \"%s\"",
442+
NameListToString(stmt->funcname),"trigger")));
443443
}
444444

445445
/*

‎src/backend/commands/typecmds.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -450,14 +450,14 @@ DefineType(List *names, List *parameters)
450450
{
451451
/* backwards-compatibility hack */
452452
ereport(WARNING,
453-
(errmsg("changing return type of function %s from \"opaque\" to%s",
454-
NameListToString(inputName),typeName)));
453+
(errmsg("changing return type of function %s from \"%s\" to\"%s\"",
454+
NameListToString(inputName),"opaque",typeName)));
455455
SetFunctionReturnType(inputOid,typoid);
456456
}
457457
else
458458
ereport(ERROR,
459459
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
460-
errmsg("type input function %s must return type%s",
460+
errmsg("type input function %s must return type\"%s\"",
461461
NameListToString(inputName),typeName)));
462462
}
463463
resulttype=get_func_rettype(outputOid);
@@ -467,23 +467,23 @@ DefineType(List *names, List *parameters)
467467
{
468468
/* backwards-compatibility hack */
469469
ereport(WARNING,
470-
(errmsg("changing return type of function %s from \"opaque\" to \"cstring\"",
471-
NameListToString(outputName))));
470+
(errmsg("changing return type of function %s from \"%s\" to \"%s\"",
471+
NameListToString(outputName),"opaque","cstring")));
472472
SetFunctionReturnType(outputOid,CSTRINGOID);
473473
}
474474
else
475475
ereport(ERROR,
476476
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
477-
errmsg("type output function %s must return type \"cstring\"",
478-
NameListToString(outputName))));
477+
errmsg("type output function %s must return type \"%s\"",
478+
NameListToString(outputName),"cstring")));
479479
}
480480
if (receiveOid)
481481
{
482482
resulttype=get_func_rettype(receiveOid);
483483
if (resulttype!=typoid)
484484
ereport(ERROR,
485485
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
486-
errmsg("type receive function %s must return type%s",
486+
errmsg("type receive function %s must return type\"%s\"",
487487
NameListToString(receiveName),typeName)));
488488
}
489489
if (sendOid)
@@ -492,8 +492,8 @@ DefineType(List *names, List *parameters)
492492
if (resulttype!=BYTEAOID)
493493
ereport(ERROR,
494494
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
495-
errmsg("type send function %s must return type \"bytea\"",
496-
NameListToString(sendName))));
495+
errmsg("type send function %s must return type \"%s\"",
496+
NameListToString(sendName),"bytea")));
497497
}
498498

499499
/*
@@ -1834,8 +1834,8 @@ findTypeTypmodinFunction(List *procname)
18341834
if (get_func_rettype(procOid)!=INT4OID)
18351835
ereport(ERROR,
18361836
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1837-
errmsg("typmod_in function %s must return type \"integer\"",
1838-
NameListToString(procname))));
1837+
errmsg("typmod_in function %s must return type \"%s\"",
1838+
NameListToString(procname),"integer")));
18391839

18401840
returnprocOid;
18411841
}
@@ -1861,8 +1861,8 @@ findTypeTypmodoutFunction(List *procname)
18611861
if (get_func_rettype(procOid)!=CSTRINGOID)
18621862
ereport(ERROR,
18631863
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1864-
errmsg("typmod_out function %s must return type \"cstring\"",
1865-
NameListToString(procname))));
1864+
errmsg("typmod_out function %s must return type \"%s\"",
1865+
NameListToString(procname),"cstring")));
18661866

18671867
returnprocOid;
18681868
}
@@ -1888,8 +1888,8 @@ findTypeAnalyzeFunction(List *procname, Oid typeOid)
18881888
if (get_func_rettype(procOid)!=BOOLOID)
18891889
ereport(ERROR,
18901890
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1891-
errmsg("type analyze function %s must return type \"boolean\"",
1892-
NameListToString(procname))));
1891+
errmsg("type analyze function %s must return type \"%s\"",
1892+
NameListToString(procname),"boolean")));
18931893

18941894
returnprocOid;
18951895
}
@@ -2007,8 +2007,9 @@ findRangeSubtypeDiffFunction(List *procname, Oid subtype)
20072007
if (get_func_rettype(procOid)!=FLOAT8OID)
20082008
ereport(ERROR,
20092009
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2010-
errmsg("range subtype diff function %s must return type double precision",
2011-
func_signature_string(procname,2,NIL,argList))));
2010+
errmsg("range subtype diff function %s must return type \"%s\"",
2011+
func_signature_string(procname,2,NIL,argList),
2012+
"double precision")));
20122013

20132014
if (func_volatile(procOid)!=PROVOLATILE_IMMUTABLE)
20142015
ereport(ERROR,

‎src/backend/parser/parse_clause.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,8 @@ transformRangeTableSample(ParseState *pstate, RangeTableSample *rts)
758758
if (get_func_rettype(handlerOid)!=TSM_HANDLEROID)
759759
ereport(ERROR,
760760
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
761-
errmsg("function %s must return type \"tsm_handler\"",
762-
NameListToString(rts->method)),
761+
errmsg("function %s must return type \"%s\"",
762+
NameListToString(rts->method),"tsm_handler"),
763763
parser_errposition(pstate,rts->location)));
764764

765765
/* OK, run the handler to get TsmRoutine, for argument type info */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp