Some leftovers of recent message cleanup? - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Some leftovers of recent message cleanup?
Date
Msg-id 20210819.170315.1413060634876301811.horikyota.ntt@gmail.com
Whole thread Raw
Responses Re: Some leftovers of recent message cleanup?
List pgsql-hackers
Hello.

While I was examining message translation for PG14, I found some
messages that would need to be fixed.

0001 is a fix for perhaps-leftovers of the recent message cleanups
related to "positive integer"(fd90f6ba7a).

0002 is a fix for a maybe-mistake in message convention of a recent
fix in ECPG of linked-connection (about trailing period and
lower-cased commad names)

0003 is a fix for remaining "positive" use, which are in doubt in
worthiness to fix..

Please find the attached.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
From 3bf651b5224915045c824eee48a5c3441432ccca Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Thu, 19 Aug 2021 16:53:24 +0900
Subject: [PATCH 1/3] Additional message fix related to "positive" wordings

While fd90f6ba7a intended to eliminate the usage of "positive integer"
and alike, it forgot to fix the same messages other places.  Complete
the work.
---
 src/backend/parser/parse_utilcmd.c | 2 +-
 src/backend/utils/adt/tsquery.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 675e400839..3b656f2f13 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -4035,7 +4035,7 @@ transformPartitionBound(ParseState *pstate, Relation parent,
         if (spec->modulus <= 0)
             ereport(ERROR,
                     (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
-                     errmsg("modulus for hash partition must be a positive integer")));
+                     errmsg("modulus for hash partition must be an integer greater than zero")));
 
         Assert(spec->remainder >= 0);
 
diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c
index b2ca0d2f8a..ded919b39b 100644
--- a/src/backend/utils/adt/tsquery.c
+++ b/src/backend/utils/adt/tsquery.c
@@ -196,7 +196,7 @@ parse_phrase_operator(TSQueryParserState pstate, int16 *distance)
                 else if (errno == ERANGE || l < 0 || l > MAXENTRYPOS)
                     ereport(ERROR,
                             (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                             errmsg("distance in phrase operator should not be greater than %d",
+                             errmsg("distance in phrase operator must be an integer value between zero and %d
inclusive",
                                     MAXENTRYPOS)));
                 else
                 {
-- 
2.27.0

From 75a03d39c83b080aca505a343e3a8381ef7703c4 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Thu, 19 Aug 2021 16:53:54 +0900
Subject: [PATCH 2/3] Message cleanup.

---
 src/interfaces/ecpg/preproc/ecpg.header | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header
index efb2fb3a38..df58f1535c 100644
--- a/src/interfaces/ecpg/preproc/ecpg.header
+++ b/src/interfaces/ecpg/preproc/ecpg.header
@@ -596,7 +596,7 @@ check_declared_list(const char *name)
         {
             if (connection)
             if (connection && strcmp(ptr->connection, connection) != 0)
-                mmerror(PARSE_ERROR, ET_WARNING, "connection %s is overwritten with %s by declare statement %s.",
connection,ptr->connection, name);
 
+                mmerror(PARSE_ERROR, ET_WARNING, "connection %s is overwritten with %s by DECLARE statement %s",
connection,ptr->connection, name);
 
             connection = mm_strdup(ptr -> connection);
             return true;
         }
-- 
2.27.0

From 8f4f993de671f0af594614b1a3e3218ee3d5fe70 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Thu, 19 Aug 2021 16:21:02 +0900
Subject: [PATCH 3/3] Exterminate usages of "positive"

Additional fix for "positive number"s.
---
 doc/src/sgml/ref/create_function.sgml | 4 ++--
 src/backend/commands/functioncmds.c   | 4 ++--
 src/backend/tsearch/wparser_def.c     | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml
index 7e6d52c7dc..1e10ac14c4 100644
--- a/doc/src/sgml/ref/create_function.sgml
+++ b/doc/src/sgml/ref/create_function.sgml
@@ -464,7 +464,7 @@ CREATE [ OR REPLACE ] FUNCTION
 
      <listitem>
       <para>
-       A positive number giving the estimated execution cost for the function,
+       A number greater than zero giving the estimated execution cost for the function,
        in units of <xref linkend="guc-cpu-operator-cost"/>.  If the function
        returns a set, this is the cost per returned row.  If the cost is
        not specified, 1 unit is assumed for C-language and internal functions,
@@ -480,7 +480,7 @@ CREATE [ OR REPLACE ] FUNCTION
 
      <listitem>
       <para>
-       A positive number giving the estimated number of rows that the planner
+       A number greater than zero giving the estimated number of rows that the planner
        should expect the function to return.  This is only allowed when the
        function is declared to return a set.  The default assumption is
        1000 rows.
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 79d875ab10..80f9f1a22b 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -829,7 +829,7 @@ compute_function_attributes(ParseState *pstate,
         if (*procost <= 0)
             ereport(ERROR,
                     (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                     errmsg("COST must be positive")));
+                     errmsg("COST must be greater than zero")));
     }
     if (rows_item)
     {
@@ -837,7 +837,7 @@ compute_function_attributes(ParseState *pstate,
         if (*prorows <= 0)
             ereport(ERROR,
                     (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                     errmsg("ROWS must be positive")));
+                     errmsg("ROWS must be greater than zero")));
     }
     if (support_item)
         *prosupport = interpret_func_support(support_item);
diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparser_def.c
index 559dff6355..36b24d3aea 100644
--- a/src/backend/tsearch/wparser_def.c
+++ b/src/backend/tsearch/wparser_def.c
@@ -2598,7 +2598,7 @@ prsd_headline(PG_FUNCTION_ARGS)
         if (min_words <= 0)
             ereport(ERROR,
                     (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                     errmsg("MinWords should be positive")));
+                     errmsg("MinWords should be greater than zero")));
         if (shortword < 0)
             ereport(ERROR,
                     (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-- 
2.27.0


pgsql-hackers by date:

Previous
From: "liuhuailing@fujitsu.com"
Date:
Subject: RE: SI messages sent when excuting ROLLBACK PREPARED command
Next
From: Michael Paquier
Date:
Subject: Re: elog.c query_id support vs shutdown