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

Commite7f3645

Browse files
committed
Fix some localizability issues with existing errcontext() calls.
1 parent2d7a6a9 commite7f3645

File tree

3 files changed

+34
-22
lines changed

3 files changed

+34
-22
lines changed

‎src/pl/plpgsql/src/pl_comp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.61 2003/07/26 23:58:23 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.62 2003/07/27 18:38:26 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -720,7 +720,7 @@ static void
720720
plpgsql_compile_error_callback(void*arg)
721721
{
722722
if (plpgsql_error_funcname)
723-
errcontext("compile of PL/pgSQL function%s near line %d",
723+
errcontext("compile of PL/pgSQL function\"%s\" near line %d",
724724
plpgsql_error_funcname,plpgsql_error_lineno);
725725
}
726726

‎src/pl/plpgsql/src/pl_exec.c

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.88 2003/07/25 23:37:28 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.89 2003/07/27 18:38:26 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -190,7 +190,7 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
190190
/*
191191
* Make local execution copies of all the datums
192192
*/
193-
estate.err_text="while initialization of execution state";
193+
estate.err_text=gettext_noop("during initialization of execution state");
194194
for (i=0;i<func->ndatums;i++)
195195
{
196196
switch (func->datums[i]->dtype)
@@ -217,9 +217,9 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
217217
}
218218

219219
/*
220-
*Put the actual call argument values into the variables
220+
*Store the actual call argument values into the variables
221221
*/
222-
estate.err_text="whileputting call argumentsto local variables";
222+
estate.err_text=gettext_noop("whilestoring call argumentsinto local variables");
223223
for (i=0;i<func->fn_nargs;i++)
224224
{
225225
intn=func->fn_argvarnos[i];
@@ -259,7 +259,7 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
259259
* Initialize the other variables to NULL values for now. The default
260260
* values are set when the blocks are entered.
261261
*/
262-
estate.err_text="while initializing local variables to NULL";
262+
estate.err_text=gettext_noop("while initializing local variables to NULL");
263263
for (i=estate.found_varno;i<estate.ndatums;i++)
264264
{
265265
switch (estate.datums[i]->dtype)
@@ -298,7 +298,7 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
298298
if (exec_stmt_block(&estate,func->action)!=PLPGSQL_RC_RETURN)
299299
{
300300
estate.err_stmt=NULL;
301-
estate.err_text="at END of toplevel PL block";
301+
estate.err_text=NULL;
302302
ereport(ERROR,
303303
(errcode(ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT),
304304
errmsg("control reached end of function without RETURN")));
@@ -308,7 +308,7 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
308308
* We got a return value - process it
309309
*/
310310
estate.err_stmt=NULL;
311-
estate.err_text="while casting return value to function's return type";
311+
estate.err_text=gettext_noop("while casting return value to function's return type");
312312

313313
fcinfo->isnull=estate.retisnull;
314314

@@ -425,7 +425,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
425425
/*
426426
* Make local execution copies of all the datums
427427
*/
428-
estate.err_text="while initialization of execution state";
428+
estate.err_text=gettext_noop("during initialization of execution state");
429429
for (i=0;i<func->ndatums;i++)
430430
{
431431
switch (func->datums[i]->dtype)
@@ -556,10 +556,10 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
556556
var->value=Int16GetDatum(trigdata->tg_trigger->tgnargs);
557557

558558
/*
559-
*Put the actual call argument values into the special execution
559+
*Store the actual call argument values into the special execution
560560
* state variables
561561
*/
562-
estate.err_text="whileputting call argumentsto local variables";
562+
estate.err_text=gettext_noop("whilestoring call argumentsinto local variables");
563563
estate.trig_nargs=trigdata->tg_trigger->tgnargs;
564564
if (estate.trig_nargs==0)
565565
estate.trig_argv=NULL;
@@ -575,7 +575,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
575575
* Initialize the other variables to NULL values for now. The default
576576
* values are set when the blocks are entered.
577577
*/
578-
estate.err_text="while initializing local variables to NULL";
578+
estate.err_text=gettext_noop("while initializing local variables to NULL");
579579
for (i=estate.found_varno;i<estate.ndatums;i++)
580580
{
581581
switch (estate.datums[i]->dtype)
@@ -615,7 +615,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
615615
if (exec_stmt_block(&estate,func->action)!=PLPGSQL_RC_RETURN)
616616
{
617617
estate.err_stmt=NULL;
618-
estate.err_text="at END of toplevel PL block";
618+
estate.err_text=NULL;
619619
ereport(ERROR,
620620
(errcode(ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT),
621621
errmsg("control reached end of trigger procedure without RETURN")));
@@ -681,16 +681,28 @@ plpgsql_exec_error_callback(void *arg)
681681
return;
682682

683683
if (estate->err_stmt!=NULL)
684-
errcontext("PL/pgSQL function %s line %d at %s",
684+
{
685+
/* translator: last %s is a plpgsql statement type name */
686+
errcontext("PL/pgSQL function \"%s\" line %d at %s",
685687
estate->err_func->fn_name,
686688
estate->err_stmt->lineno,
687689
plpgsql_stmt_typename(estate->err_stmt));
690+
}
688691
elseif (estate->err_text!=NULL)
689-
errcontext("PL/pgSQL function %s %s",
692+
{
693+
/*
694+
* We don't expend the cycles to run gettext() on err_text unless
695+
* we actually need it. Therefore, places that set up err_text should
696+
* use gettext_noop() to ensure the strings get recorded in the
697+
* message dictionary.
698+
*/
699+
/* translator: last %s is a phrase such as "while storing call arguments into local variables" */
700+
errcontext("PL/pgSQL function \"%s\" %s",
690701
estate->err_func->fn_name,
691-
estate->err_text);
702+
gettext(estate->err_text));
703+
}
692704
else
693-
errcontext("PL/pgSQL function%s",
705+
errcontext("PL/pgSQL function\"%s\"",
694706
estate->err_func->fn_name);
695707
}
696708

‎src/test/regress/expected/plpgsql.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,16 +1518,16 @@ insert into PField values ('PF1_1', 'should fail due to unique index');
15181518
ERROR: duplicate key violates UNIQUE constraint "pfield_name"
15191519
update PSlot set backlink = 'WS.not.there' where slotname = 'PS.base.a1';
15201520
ERROR: WS.not.there does not exist
1521-
CONTEXT: PL/pgSQL function tg_backlink_a line 16 at assignment
1521+
CONTEXT: PL/pgSQL function"tg_backlink_a" line 16 at assignment
15221522
update PSlot set backlink = 'XX.illegal' where slotname = 'PS.base.a1';
15231523
ERROR: illegal backlink beginning with XX
1524-
CONTEXT: PL/pgSQL function tg_backlink_a line 16 at assignment
1524+
CONTEXT: PL/pgSQL function"tg_backlink_a" line 16 at assignment
15251525
update PSlot set slotlink = 'PS.not.there' where slotname = 'PS.base.a1';
15261526
ERROR: PS.not.there does not exist
1527-
CONTEXT: PL/pgSQL function tg_slotlink_a line 16 at assignment
1527+
CONTEXT: PL/pgSQL function"tg_slotlink_a" line 16 at assignment
15281528
update PSlot set slotlink = 'XX.illegal' where slotname = 'PS.base.a1';
15291529
ERROR: illegal slotlink beginning with XX
1530-
CONTEXT: PL/pgSQL function tg_slotlink_a line 16 at assignment
1530+
CONTEXT: PL/pgSQL function"tg_slotlink_a" line 16 at assignment
15311531
insert into HSlot values ('HS', 'base.hub1', 1, '');
15321532
ERROR: duplicate key violates UNIQUE constraint "hslot_name"
15331533
insert into HSlot values ('HS', 'base.hub1', 20, '');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp