Message wordsmithing
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 18 Feb 2009 11:33:04 +0000 (11:33 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 18 Feb 2009 11:33:04 +0000 (11:33 +0000)
src/pl/plpgsql/src/gram.y
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/pl_funcs.c
src/pl/plpgsql/src/pl_handler.c
src/pl/plpgsql/src/scan.l
src/test/regress/expected/plpgsql.out

index f9a2eabe328b858702ccd38e0d8d066371b1f196..79d4f61625578daa3a374bdeeff1c45f861bb97d 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.120 2009/02/02 20:25:38 tgl Exp $
+ *   $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.121 2009/02/18 11:33:04 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1043,7 +1043,7 @@ for_control       :
                            if ($2.scalar && $2.row)
                                ereport(ERROR,
                                        (errcode(ERRCODE_SYNTAX_ERROR),
-                                        errmsg("cursor FOR loop must have just one target variable")));
+                                        errmsg("cursor FOR loop must have only one target variable")));
 
                            /* create loop's private RECORD variable */
                            plpgsql_convert_ident($2.name, &varname, 1);
@@ -1131,7 +1131,7 @@ for_control       :
                                if ($2.scalar && $2.row)
                                    ereport(ERROR,
                                            (errcode(ERRCODE_SYNTAX_ERROR),
-                                            errmsg("integer FOR loop must have just one target variable")));
+                                            errmsg("integer FOR loop must have only one target variable")));
 
                                /* create loop's private variable */
                                plpgsql_convert_ident($2.name, &varname, 1);
@@ -1570,7 +1570,7 @@ stmt_open     : K_OPEN lno cursor_variable
                                        (errcode(ERRCODE_SYNTAX_ERROR),
                                         errmsg("syntax error at \"%s\"",
                                                yytext),
-                                        errdetail("Expected FOR to open a reference cursor.")));
+                                        errdetail("Expected \"FOR\", to open a reference cursor.")));
                            }
 
                            tok = yylex();
@@ -1664,7 +1664,7 @@ cursor_variable   : T_SCALAR
                            plpgsql_error_lineno = plpgsql_scanner_lineno();
                            ereport(ERROR,
                                    (errcode(ERRCODE_DATATYPE_MISMATCH),
-                                    errmsg("\"%s\" must be of type cursor or refcursor",
+                                    errmsg("variable \"%s\" must be of type cursor or refcursor",
                                            ((PLpgSQL_var *) yylval.scalar)->refname)));
                        }
                        $$ = (PLpgSQL_var *) yylval.scalar;
@@ -2094,7 +2094,7 @@ read_datatype(int tok)
            if (parenlevel != 0)
                yyerror("mismatched parentheses");
            else
-               yyerror("incomplete datatype declaration");
+               yyerror("incomplete data type declaration");
        }
        /* Possible followers for datatype in a declaration */
        if (tok == K_NOT || tok == K_ASSIGN || tok == K_DEFAULT)
@@ -2119,7 +2119,7 @@ read_datatype(int tok)
    type_name = plpgsql_dstring_get(&ds);
 
    if (type_name[0] == '\0')
-       yyerror("missing datatype declaration");
+       yyerror("missing data type declaration");
 
    plpgsql_error_lineno = lno; /* in case of error in parse_datatype */
 
@@ -2375,11 +2375,11 @@ make_return_stmt(int lineno)
                break;
 
            default:
-               yyerror("RETURN must specify a record or row variable in function returning tuple");
+               yyerror("RETURN must specify a record or row variable in function returning row");
                break;
        }
        if (yylex() != ';')
-           yyerror("RETURN must specify a record or row variable in function returning tuple");
+           yyerror("RETURN must specify a record or row variable in function returning row");
    }
    else
    {
@@ -2428,11 +2428,11 @@ make_return_next_stmt(int lineno)
                break;
 
            default:
-               yyerror("RETURN NEXT must specify a record or row variable in function returning tuple");
+               yyerror("RETURN NEXT must specify a record or row variable in function returning row");
                break;
        }
        if (yylex() != ';')
-           yyerror("RETURN NEXT must specify a record or row variable in function returning tuple");
+           yyerror("RETURN NEXT must specify a record or row variable in function returning row");
    }
    else
        new->expr = plpgsql_read_expression(';', ";");
@@ -2745,7 +2745,7 @@ check_label(const char *yytxt)
 
    plpgsql_convert_ident(yytxt, &label_name, 1);
    if (plpgsql_ns_lookup_label(label_name) == NULL)
-       yyerror("no such label");
+       yyerror("label does not exist");
    return label_name;
 }
 
index c87afd013c5cd5e63fe2b66a480dd1b31f6d5663..b2673dcd486895d62c88ec8f58a34f7eb2090bab 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.133 2009/01/01 17:24:03 momjian Exp $
+ *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.134 2009/02/18 11:33:04 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -415,7 +415,7 @@ do_compile(FunctionCallInfo fcinfo,
                    argdtype->ttype != PLPGSQL_TTYPE_ROW)
                    ereport(ERROR,
                            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                            errmsg("plpgsql functions cannot take type %s",
+                            errmsg("PL/pgSQL functions cannot accept type %s",
                                    format_type_be(argtypeid))));
 
                /* Build variable and add to datum list */
@@ -534,7 +534,7 @@ do_compile(FunctionCallInfo fcinfo,
                else
                    ereport(ERROR,
                            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                            errmsg("plpgsql functions cannot return type %s",
+                            errmsg("PL/pgSQL functions cannot return type %s",
                                    format_type_be(rettypeid))));
            }
 
@@ -576,7 +576,7 @@ do_compile(FunctionCallInfo fcinfo,
                ereport(ERROR,
                        (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
                  errmsg("trigger functions cannot have declared arguments"),
-                        errhint("You probably want to use TG_NARGS and TG_ARGV instead.")));
+                        errhint("The arguments of the trigger can be accessed through TG_NARGS and TG_ARGV instead.")));
 
            /* Add the record for referencing NEW */
            rec = plpgsql_build_record("new", 0, true);
@@ -766,7 +766,7 @@ plpgsql_compile_error_callback(void *arg)
    }
 
    if (plpgsql_error_funcname)
-       errcontext("compile of PL/pgSQL function \"%s\" near line %d",
+       errcontext("compilation of PL/pgSQL function \"%s\" near line %d",
                   plpgsql_error_funcname, plpgsql_error_lineno);
 }
 
index 74a2bf3a155b924a6497290377a127568f259547..0bd718dec2b090c6a72ec1fec3c0336f20e7c6b0 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.233 2009/02/17 12:51:59 petere Exp $
+ *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.234 2009/02/18 11:33:04 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -706,7 +706,7 @@ plpgsql_exec_trigger(PLpgSQL_function *func,
    {
        validate_tupdesc_compat(trigdata->tg_relation->rd_att,
                                estate.rettupdesc,
-                               "returned tuple structure does not match table of trigger event");
+                               "returned row structure does not match the structure of the triggering table");
        /* Copy tuple to upper executor memory */
        rettup = SPI_copytuple((HeapTuple) DatumGetPointer(estate.retval));
    }
@@ -765,24 +765,18 @@ plpgsql_exec_error_callback(void *arg)
         */
        if (estate->err_stmt != NULL)
        {
-           /*
-            * translator: last %s is a phrase such as "during statement block
-            * local variable initialization"
-            */
+           /* translator: last %s is a phrase such as "during statement block local variable initialization" */
            errcontext("PL/pgSQL function \"%s\" line %d %s",
                       estate->err_func->fn_name,
                       estate->err_stmt->lineno,
-                      gettext(estate->err_text));
+                      _(estate->err_text));
        }
        else
        {
-           /*
-            * translator: last %s is a phrase such as "while storing call
-            * arguments into local variables"
-            */
+           /* translator: last %s is a phrase such as "while storing call arguments into local variables" */
            errcontext("PL/pgSQL function \"%s\" %s",
                       estate->err_func->fn_name,
-                      gettext(estate->err_text));
+                      _(estate->err_text));
        }
    }
    else if (estate->err_stmt != NULL)
@@ -1677,7 +1671,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
    if (isnull)
        ereport(ERROR,
                (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                errmsg("lower bound of FOR loop cannot be NULL")));
+                errmsg("lower bound of FOR loop cannot be null")));
    loop_value = DatumGetInt32(value);
    exec_eval_cleanup(estate);
 
@@ -1692,7 +1686,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
    if (isnull)
        ereport(ERROR,
                (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                errmsg("upper bound of FOR loop cannot be NULL")));
+                errmsg("upper bound of FOR loop cannot be null")));
    end_value = DatumGetInt32(value);
    exec_eval_cleanup(estate);
 
@@ -1709,7 +1703,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
        if (isnull)
            ereport(ERROR,
                    (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                    errmsg("BY value of FOR loop cannot be NULL")));
+                    errmsg("BY value of FOR loop cannot be null")));
        step_value = DatumGetInt32(value);
        exec_eval_cleanup(estate);
        if (step_value <= 0)
@@ -2470,7 +2464,7 @@ exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt)
        if (optionisnull)
            ereport(ERROR,
                    (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                    errmsg("RAISE statement option cannot be NULL")));
+                    errmsg("RAISE statement option cannot be null")));
 
        extval = convert_value_to_string(optionvalue, optiontypeid);
 
@@ -2916,7 +2910,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
    if (isnull)
        ereport(ERROR,
                (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                errmsg("cannot EXECUTE a null querystring")));
+                errmsg("query string argument of EXECUTE is null")));
 
    /* Get the C-String representation */
    querystr = convert_value_to_string(query, restype);
@@ -2981,7 +2975,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
                if (*ptr == 'S' || *ptr == 's')
                    ereport(ERROR,
                            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                            errmsg("EXECUTE of SELECT ... INTO is not implemented yet")));
+                            errmsg("EXECUTE of SELECT ... INTO is not implemented")));
                break;
            }
 
@@ -3166,7 +3160,7 @@ exec_stmt_open(PLpgSQL_execstate *estate, PLpgSQL_stmt_open *stmt)
        if (isnull)
            ereport(ERROR,
                    (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                    errmsg("cannot EXECUTE a null querystring")));
+                    errmsg("query string argument of EXECUTE is null")));
 
        /* Get the C-String representation */
        querystr = convert_value_to_string(queryD, restype);
@@ -3300,7 +3294,7 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
    if (curvar->isnull)
        ereport(ERROR,
                (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                errmsg("cursor variable \"%s\" is NULL", curvar->refname)));
+                errmsg("cursor variable \"%s\" is null", curvar->refname)));
    curname = TextDatumGetCString(curvar->value);
 
    portal = SPI_cursor_find(curname);
@@ -3321,7 +3315,7 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
        if (isnull)
            ereport(ERROR,
                    (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                    errmsg("relative or absolute cursor position is NULL")));
+                    errmsg("relative or absolute cursor position is null")));
 
        exec_eval_cleanup(estate);
    }
@@ -3396,7 +3390,7 @@ exec_stmt_close(PLpgSQL_execstate *estate, PLpgSQL_stmt_close *stmt)
    if (curvar->isnull)
        ereport(ERROR,
                (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                errmsg("cursor variable \"%s\" is NULL", curvar->refname)));
+                errmsg("cursor variable \"%s\" is null", curvar->refname)));
    curname = TextDatumGetCString(curvar->value);
 
    portal = SPI_cursor_find(curname);
@@ -3463,7 +3457,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
                if (*isNull && var->notnull)
                    ereport(ERROR,
                            (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                            errmsg("NULL cannot be assigned to variable \"%s\" declared NOT NULL",
+                            errmsg("null value cannot be assigned to variable \"%s\" declared NOT NULL",
                                    var->refname)));
 
                /*
@@ -3720,8 +3714,8 @@ exec_assign_value(PLpgSQL_execstate *estate,
                    if (nsubscripts >= MAXDIM)
                        ereport(ERROR,
                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
-                                errmsg("number of array dimensions exceeds the maximum allowed, %d",
-                                       MAXDIM)));
+                                errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
+                                       nsubscripts, MAXDIM)));
                    subscripts[nsubscripts++] = arrayelem->subscript;
                    target = estate->datums[arrayelem->arrayparentno];
                } while (target->dtype == PLPGSQL_DTYPE_ARRAYELEM);
@@ -3757,7 +3751,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
                    if (subisnull)
                        ereport(ERROR,
                                (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                                errmsg("array subscript in assignment must not be NULL")));
+                                errmsg("array subscript in assignment must not be null")));
                }
 
                /* Coerce source value to match array element type. */
@@ -5129,7 +5123,7 @@ static void
 validate_tupdesc_compat(TupleDesc expected, TupleDesc returned, const char *msg)
 {
    int        i;
-   const char *dropped_column_type = gettext_noop("n/a (dropped column)");
+   const char *dropped_column_type = gettext_noop("N/A (dropped column)");
 
    if (!expected || !returned)
        ereport(ERROR,
@@ -5402,7 +5396,7 @@ exec_dynquery_with_params(PLpgSQL_execstate *estate, PLpgSQL_expr *dynquery,
    if (isnull)
        ereport(ERROR,
                (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
-                errmsg("cannot EXECUTE a null querystring")));
+                errmsg("query string argument of EXECUTE is null")));
 
    /* Get the C-String representation */
    querystr = convert_value_to_string(query, restype);
index 0581dade8cfba0f41ee516593c7224d0595368e9..b6cd6c51507340d6917a6b1e437f8b28cb170ad8 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.75 2009/01/01 17:24:04 momjian Exp $
+ *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.76 2009/02/18 11:33:04 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -356,7 +356,7 @@ plpgsql_ns_rename(char *oldname, char *newname)
 
    ereport(ERROR,
            (errcode(ERRCODE_UNDEFINED_OBJECT),
-            errmsg("there is no variable \"%s\" in the current block",
+            errmsg("variable \"%s\" does not exist in the current block",
                    oldname)));
 }
 
@@ -412,7 +412,7 @@ plpgsql_convert_ident(const char *s, char **output, int numidents)
            if (*s != '"')      /* should not happen if lexer checked */
                ereport(ERROR,
                        (errcode(ERRCODE_SYNTAX_ERROR),
-                        errmsg("unterminated \" in name: %s", sstart)));
+                        errmsg("unterminated \" in identifier: %s", sstart)));
            s++;
            *cp = '\0';
            /* Truncate to NAMEDATALEN */
index 399d995254f2edc80e2fe13c4bae8a877d1116c9..3b362e78e763ba72040f20bec1798ba12ffc5250 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.43 2009/01/01 17:24:04 momjian Exp $
+ *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.44 2009/02/18 11:33:04 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -159,7 +159,7 @@ plpgsql_validator(PG_FUNCTION_ARGS)
                 !IsPolymorphicType(proc->prorettype))
            ereport(ERROR,
                    (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                    errmsg("plpgsql functions cannot return type %s",
+                    errmsg("PL/pgSQL functions cannot return type %s",
                            format_type_be(proc->prorettype))));
    }
 
@@ -174,7 +174,7 @@ plpgsql_validator(PG_FUNCTION_ARGS)
            if (!IsPolymorphicType(argtypes[i]))
                ereport(ERROR,
                        (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                        errmsg("plpgsql functions cannot take type %s",
+                        errmsg("PL/pgSQL functions cannot accept type %s",
                                format_type_be(argtypes[i]))));
        }
    }
index b62d58b02bdaf453314fa4ccb39829d39a272617..9199af672684e4b93803ee507ebd6b86ba92f518 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.66 2009/02/17 13:01:13 petere Exp $
+ *   $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.67 2009/02/18 11:33:04 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -254,7 +254,7 @@ dump            { return O_DUMP;            }
                plpgsql_error_lineno = start_lineno;
                ereport(ERROR,
                        (errcode(ERRCODE_DATATYPE_MISMATCH),
-                        errmsg("unterminated comment")));
+                        errmsg("unterminated /* comment")));
            }
 
     /* ----------
@@ -293,7 +293,7 @@ dump            { return O_DUMP;            }
                plpgsql_error_lineno = start_lineno;
                ereport(ERROR,
                        (errcode(ERRCODE_DATATYPE_MISMATCH),
-                        errmsg("unterminated string")));
+                        errmsg("unterminated quoted string")));
            }
 
 {dolqdelim}        {
index 0fe279493f214f874e2f0231aaad6185a3b372e4..66bd895f705ec97b86b0fff700c6339d8aaa76ba 100644 (file)
@@ -2700,7 +2700,7 @@ begin
   end loop flbl1;
 end;
 $$ language plpgsql;
-ERROR:  no such label at or near "flbl1"
+ERROR:  label does not exist at or near "flbl1"
 LINE 5:   end loop flbl1;
                    ^
 -- should fail: end label does not match start label
@@ -2714,7 +2714,7 @@ begin
 end;
 $$ language plpgsql;
 ERROR:  end label "outer_label" differs from block's label "inner_label"
-CONTEXT:  compile of PL/pgSQL function "end_label3" near line 6
+CONTEXT:  compilation of PL/pgSQL function "end_label3" near line 6
 -- should fail: end label on a block without a start label
 create function end_label4() returns void as $$
 <<outer_label>>
@@ -2725,7 +2725,7 @@ begin
 end;
 $$ language plpgsql;
 ERROR:  end label "outer_label" specified for unlabelled block
-CONTEXT:  compile of PL/pgSQL function "end_label4" near line 5
+CONTEXT:  compilation of PL/pgSQL function "end_label4" near line 5
 -- using list of scalars in fori and fore stmts
 create function for_vect() returns void as $proc$
 <<lbl>>declare a integer; b varchar; c varchar; r record;
@@ -3266,7 +3266,7 @@ begin
 end;
 $$ language plpgsql;
 ERROR:  cursor FOR loop must use a bound cursor variable
-CONTEXT:  compile of PL/pgSQL function "forc_bad" near line 4
+CONTEXT:  compilation of PL/pgSQL function "forc_bad" near line 4
 -- test RETURN QUERY EXECUTE
 create or replace function return_dquery()
 returns setof int as $$