Improve error message about valid value for distance in phrase operator.
authorFujii Masao <[email protected]>
Wed, 25 Aug 2021 02:43:56 +0000 (11:43 +0900)
committerFujii Masao <[email protected]>
Wed, 25 Aug 2021 02:45:37 +0000 (11:45 +0900)
The distance in phrase operator must be an integer value between zero
and MAXENTRYPOS inclusive. But previously the error message about
its valid value included the information about its upper limit
but not lower limit (i.e., zero). This commit improves the error message
so that it also includes the information about its lower limit.

Back-patch to v9.6 where full-text phrase search was supported.

Author: Kyotaro Horiguchi
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/20210819.170315.1413060634876301811[email protected]

src/backend/utils/adt/tsquery.c

index fdb041971e5228538b5edda16339abef378a9b77..27b74bcbf818b97b483e2b373509983bbde4c46c 100644 (file)
@@ -163,7 +163,7 @@ parse_phrase_operator(char *buf, 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
                {