At Wed, 19 May 2021 21:48:56 +0530, Bharath Rupireddy 
<bharath.rupireddyforpostg...@gmail.com> wrote in 
> On Wed, May 19, 2021 at 5:20 PM Fujii Masao <masao.fu...@oss.nttdata.com> 
> wrote:
> > I'm fine to convert "non-negative" word to "greater than" or "greater than
> > or equal to" in the messages. But this change also seems to get rid of
> > the information about the data type of the option from the message.
> > I'm not sure if this is an improvement. Probably isn't it better to
> > convert "requires a non-negative integer value" to "must be an integer value
> > greater than zero"?
> 
> Thanks for the comments. Done that way. PSA v3 patch.

--- a/src/backend/utils/adt/tsquery_op.c
+++ b/src/backend/utils/adt/tsquery_op.c
@@ -121,7 +121,7 @@ tsquery_phrase_distance(PG_FUNCTION_ARGS)
        if (distance < 0 || distance > MAXENTRYPOS)
                ereport(ERROR,
                                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                                errmsg("distance in phrase operator should be 
non-negative and less than %d",
+                                errmsg("distance in phrase operator must be an 
integer value greater than or equal to zero and less than %d",
                                                MAXENTRYPOS)));

Though it is not due to this patch, but the message looks wrong. The condition 
is suggesting:

"distance in phrase operator must be an integer value greater than or equal to 
zero and less than or equal to %d"

I'm not sure readers can read it without biting their tongue.  How
about something like the following instead?

"distance in phrase operator must be an integer value between zero and
 %d inclusive."

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center


Reply via email to