nocfbot-0034-Fix-passive-voice-RPR-error-messages.txt

text/plain

Filename: nocfbot-0034-Fix-passive-voice-RPR-error-messages.txt
Type: text/plain
Part: 33
Message: Re: Row pattern recognition
From 10dc83735b042833db79ae7c131b4739c37e7580 Mon Sep 17 00:00:00 2001
From: Henson Choi <assam258@gmail.com>
Date: Sat, 2 May 2026 00:30:19 +0900
Subject: [PATCH 34/40] Fix passive voice in RPR error messages

Several RPR error messages used passive constructions like "X is not
permitted when row pattern recognition is used" or
"<funcname>() can only be used in a DEFINE clause".  PostgreSQL's
message style guide prefers active voice for prohibitions and
constraints; rephrase the affected messages so the action is the
subject.

  - "FRAME option {GROUPS,RANGE} is not permitted when row pattern
    recognition is used" -> "cannot use FRAME option {GROUPS,RANGE}
    with row pattern recognition"
  - "EXCLUDE options are not permitted when row pattern recognition
    is used" -> "cannot use EXCLUDE options with row pattern
    recognition"
  - "FRAME must start at CURRENT ROW when row pattern recognition is
    used" -> "... when using row pattern recognition" (constraint
    form retained, only the trailing passive participle replaced)
  - "row pattern navigation cannot be nested more than two levels
    deep" -> "cannot nest row pattern navigation more than two
    levels deep"
  - "%s can only be used in a DEFINE clause" (parse_func.c) and
    eight matching defensive stubs in windowfuncs.c
    ("PREV()/NEXT()/FIRST()/LAST() can only be used in a DEFINE
    clause") -> "cannot use ... outside a DEFINE clause"

State-describing messages such as "DEFINE variable %s is not used
in PATTERN" and copula constraints like "must be a direct argument
of the outer navigation" / "offset must not be negative" are left
as is; they are not passive in the prohibition sense and follow
existing PG idioms.

Update regression tests (rpr_base.sql/.out and rpr.out) to match
the new wording.
---
 src/backend/parser/parse_func.c        |  2 +-
 src/backend/parser/parse_rpr.c         | 10 ++---
 src/backend/utils/adt/windowfuncs.c    | 16 ++++----
 src/test/regress/expected/rpr.out      | 14 +++----
 src/test/regress/expected/rpr_base.out | 56 +++++++++++++-------------
 src/test/regress/sql/rpr_base.sql      | 24 +++++------
 6 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index aa45a98713f..07bf11965b8 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -790,7 +790,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
 		/* Not a column projection — report error */
 		ereport(ERROR,
 				(errcode(ERRCODE_SYNTAX_ERROR),
-				 errmsg("%s can only be used in a DEFINE clause",
+				 errmsg("cannot use %s outside a DEFINE clause",
 						NameListToString(funcname)),
 				 parser_errposition(pstate, location)));
 	}
diff --git a/src/backend/parser/parse_rpr.c b/src/backend/parser/parse_rpr.c
index 87ccf55a5ee..f56b7db5bc8 100644
--- a/src/backend/parser/parse_rpr.c
+++ b/src/backend/parser/parse_rpr.c
@@ -76,7 +76,7 @@ transformRPR(ParseState *pstate, WindowClause *wc, WindowDef *windef,
 	if (wc->frameOptions & FRAMEOPTION_GROUPS)
 		ereport(ERROR,
 				(errcode(ERRCODE_WINDOWING_ERROR),
-				 errmsg("FRAME option GROUPS is not permitted when row pattern recognition is used"),
+				 errmsg("cannot use FRAME option GROUPS with row pattern recognition"),
 				 errhint("Use ROWS instead."),
 				 parser_errposition(pstate,
 									windef->frameLocation >= 0 ?
@@ -84,7 +84,7 @@ transformRPR(ParseState *pstate, WindowClause *wc, WindowDef *windef,
 	if (wc->frameOptions & FRAMEOPTION_RANGE)
 		ereport(ERROR,
 				(errcode(ERRCODE_WINDOWING_ERROR),
-				 errmsg("FRAME option RANGE is not permitted when row pattern recognition is used"),
+				 errmsg("cannot use FRAME option RANGE with row pattern recognition"),
 				 errhint("Use ROWS instead."),
 				 parser_errposition(pstate,
 									windef->frameLocation >= 0 ?
@@ -111,7 +111,7 @@ transformRPR(ParseState *pstate, WindowClause *wc, WindowDef *windef,
 
 		ereport(ERROR,
 				(errcode(ERRCODE_WINDOWING_ERROR),
-				 errmsg("FRAME must start at CURRENT ROW when row pattern recognition is used"),
+				 errmsg("FRAME must start at CURRENT ROW when using row pattern recognition"),
 				 errdetail("Current frame starts with %s.", startBound),
 				 errhint("Use: %s BETWEEN CURRENT ROW AND ...", frameType),
 				 parser_errposition(pstate, windef->frameLocation >= 0 ? windef->frameLocation : windef->location)));
@@ -137,7 +137,7 @@ transformRPR(ParseState *pstate, WindowClause *wc, WindowDef *windef,
 
 		ereport(ERROR,
 				(errcode(ERRCODE_WINDOWING_ERROR),
-				 errmsg("EXCLUDE options are not permitted when row pattern recognition is used"),
+				 errmsg("cannot use EXCLUDE options with row pattern recognition"),
 				 errdetail("Frame definition includes %s.", excludeType),
 				 errhint("Remove the EXCLUDE clause from the window definition."),
 				 parser_errposition(pstate, windef->excludeLocation >= 0 ? windef->excludeLocation : windef->location)));
@@ -494,7 +494,7 @@ check_rpr_nav_expr(RPRNavExpr *nav, ParseState *pstate)
 			if (result.nav_count > 1)
 				ereport(ERROR,
 						(errcode(ERRCODE_SYNTAX_ERROR),
-						 errmsg("row pattern navigation cannot be nested more than two levels deep"),
+						 errmsg("cannot nest row pattern navigation more than two levels deep"),
 						 errhint("Only PREV(FIRST()), PREV(LAST()), NEXT(FIRST()), and NEXT(LAST()) compound forms are allowed."),
 						 parser_errposition(pstate, nav->location)));
 
diff --git a/src/backend/utils/adt/windowfuncs.c b/src/backend/utils/adt/windowfuncs.c
index fb966cae43c..46e7a03a666 100644
--- a/src/backend/utils/adt/windowfuncs.c
+++ b/src/backend/utils/adt/windowfuncs.c
@@ -740,7 +740,7 @@ window_prev(PG_FUNCTION_ARGS)
 {
 	ereport(ERROR,
 			(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-			 errmsg("PREV() can only be used in a DEFINE clause")));
+			 errmsg("cannot use PREV() outside a DEFINE clause")));
 	PG_RETURN_NULL();			/* not reached */
 }
 
@@ -754,7 +754,7 @@ window_next(PG_FUNCTION_ARGS)
 {
 	ereport(ERROR,
 			(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-			 errmsg("NEXT() can only be used in a DEFINE clause")));
+			 errmsg("cannot use NEXT() outside a DEFINE clause")));
 	PG_RETURN_NULL();			/* not reached */
 }
 
@@ -768,7 +768,7 @@ window_prev_offset(PG_FUNCTION_ARGS)
 {
 	ereport(ERROR,
 			(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-			 errmsg("PREV() can only be used in a DEFINE clause")));
+			 errmsg("cannot use PREV() outside a DEFINE clause")));
 	PG_RETURN_NULL();			/* not reached */
 }
 
@@ -782,7 +782,7 @@ window_next_offset(PG_FUNCTION_ARGS)
 {
 	ereport(ERROR,
 			(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-			 errmsg("NEXT() can only be used in a DEFINE clause")));
+			 errmsg("cannot use NEXT() outside a DEFINE clause")));
 	PG_RETURN_NULL();			/* not reached */
 }
 
@@ -796,7 +796,7 @@ window_first(PG_FUNCTION_ARGS)
 {
 	ereport(ERROR,
 			(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-			 errmsg("FIRST() can only be used in a DEFINE clause")));
+			 errmsg("cannot use FIRST() outside a DEFINE clause")));
 	PG_RETURN_NULL();			/* not reached */
 }
 
@@ -810,7 +810,7 @@ window_last(PG_FUNCTION_ARGS)
 {
 	ereport(ERROR,
 			(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-			 errmsg("LAST() can only be used in a DEFINE clause")));
+			 errmsg("cannot use LAST() outside a DEFINE clause")));
 	PG_RETURN_NULL();			/* not reached */
 }
 
@@ -824,7 +824,7 @@ window_first_offset(PG_FUNCTION_ARGS)
 {
 	ereport(ERROR,
 			(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-			 errmsg("FIRST() can only be used in a DEFINE clause")));
+			 errmsg("cannot use FIRST() outside a DEFINE clause")));
 	PG_RETURN_NULL();			/* not reached */
 }
 
@@ -838,6 +838,6 @@ window_last_offset(PG_FUNCTION_ARGS)
 {
 	ereport(ERROR,
 			(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-			 errmsg("LAST() can only be used in a DEFINE clause")));
+			 errmsg("cannot use LAST() outside a DEFINE clause")));
 	PG_RETURN_NULL();			/* not reached */
 }
diff --git a/src/test/regress/expected/rpr.out b/src/test/regress/expected/rpr.out
index 32aa8bc3722..3520c5c5d76 100644
--- a/src/test/regress/expected/rpr.out
+++ b/src/test/regress/expected/rpr.out
@@ -1023,12 +1023,12 @@ WINDOW w AS (
 --
 -- PREV outside DEFINE clause
 SELECT prev(price) FROM stock;
-ERROR:  prev can only be used in a DEFINE clause
+ERROR:  cannot use prev outside a DEFINE clause
 LINE 1: SELECT prev(price) FROM stock;
                ^
 -- NEXT outside DEFINE clause
 SELECT next(price) FROM stock;
-ERROR:  next can only be used in a DEFINE clause
+ERROR:  cannot use next outside a DEFINE clause
 LINE 1: SELECT next(price) FROM stock;
                ^
 -- Nested PREV
@@ -1431,11 +1431,11 @@ WINDOW w AS (
 
 -- 2-arg PREV/NEXT outside DEFINE clause
 SELECT prev(price, 2) FROM stock;
-ERROR:  prev can only be used in a DEFINE clause
+ERROR:  cannot use prev outside a DEFINE clause
 LINE 1: SELECT prev(price, 2) FROM stock;
                ^
 SELECT next(price, 2) FROM stock;
-ERROR:  next can only be used in a DEFINE clause
+ERROR:  cannot use next outside a DEFINE clause
 LINE 1: SELECT next(price, 2) FROM stock;
                ^
 -- 2-arg PREV/NEXT: negative offset
@@ -1967,15 +1967,15 @@ SELECT id, val, count(*) OVER w FROM rpr_nav WINDOW w AS (
 ERROR:  row pattern navigation offset must not be negative
 -- FIRST/LAST outside DEFINE clause (error cases)
 SELECT first(val) FROM rpr_nav;
-ERROR:  first can only be used in a DEFINE clause
+ERROR:  cannot use first outside a DEFINE clause
 LINE 1: SELECT first(val) FROM rpr_nav;
                ^
 SELECT last(val) FROM rpr_nav;
-ERROR:  last can only be used in a DEFINE clause
+ERROR:  cannot use last outside a DEFINE clause
 LINE 1: SELECT last(val) FROM rpr_nav;
                ^
 SELECT first(val, 1) FROM rpr_nav;
-ERROR:  first can only be used in a DEFINE clause
+ERROR:  cannot use first outside a DEFINE clause
 LINE 1: SELECT first(val, 1) FROM rpr_nav;
                ^
 -- Functional notation: should access column, not RPR navigation
diff --git a/src/test/regress/expected/rpr_base.out b/src/test/regress/expected/rpr_base.out
index 912bd7b7c77..3637a5c8002 100644
--- a/src/test/regress/expected/rpr_base.out
+++ b/src/test/regress/expected/rpr_base.out
@@ -402,7 +402,7 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
-ERROR:  FRAME must start at CURRENT ROW when row pattern recognition is used
+ERROR:  FRAME must start at CURRENT ROW when using row pattern recognition
 LINE 5:     ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
             ^
 DETAIL:  Current frame starts with UNBOUNDED PRECEDING.
@@ -419,12 +419,12 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
-ERROR:  EXCLUDE options are not permitted when row pattern recognition is used
+ERROR:  cannot use EXCLUDE options with row pattern recognition
 LINE 6:     EXCLUDE CURRENT ROW
             ^
 DETAIL:  Frame definition includes EXCLUDE CURRENT ROW.
 HINT:  Remove the EXCLUDE clause from the window definition.
--- Expected: ERROR: EXCLUDE options are not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use EXCLUDE options with row pattern recognition
 -- EXCLUDE GROUP not permitted
 SELECT COUNT(*) OVER w
 FROM rpr_frame
@@ -435,12 +435,12 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
-ERROR:  EXCLUDE options are not permitted when row pattern recognition is used
+ERROR:  cannot use EXCLUDE options with row pattern recognition
 LINE 6:     EXCLUDE GROUP
             ^
 DETAIL:  Frame definition includes EXCLUDE GROUP.
 HINT:  Remove the EXCLUDE clause from the window definition.
--- Expected: ERROR: EXCLUDE options are not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use EXCLUDE options with row pattern recognition
 -- EXCLUDE TIES not permitted
 SELECT COUNT(*) OVER w
 FROM rpr_frame
@@ -451,12 +451,12 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
-ERROR:  EXCLUDE options are not permitted when row pattern recognition is used
+ERROR:  cannot use EXCLUDE options with row pattern recognition
 LINE 6:     EXCLUDE TIES
             ^
 DETAIL:  Frame definition includes EXCLUDE TIES.
 HINT:  Remove the EXCLUDE clause from the window definition.
--- Expected: ERROR: EXCLUDE options are not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use EXCLUDE options with row pattern recognition
 -- RANGE frame not starting at CURRENT ROW
 SELECT COUNT(*) OVER w
 FROM rpr_frame
@@ -466,11 +466,11 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
-ERROR:  FRAME option RANGE is not permitted when row pattern recognition is used
+ERROR:  cannot use FRAME option RANGE with row pattern recognition
 LINE 5:     RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWIN...
             ^
 HINT:  Use ROWS instead.
--- Expected: ERROR: FRAME option RANGE is not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use FRAME option RANGE with row pattern recognition
 -- GROUPS frame not starting at CURRENT ROW
 SELECT COUNT(*) OVER w
 FROM rpr_frame
@@ -480,11 +480,11 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
-ERROR:  FRAME option GROUPS is not permitted when row pattern recognition is used
+ERROR:  cannot use FRAME option GROUPS with row pattern recognition
 LINE 5:     GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWI...
             ^
 HINT:  Use ROWS instead.
--- Expected: ERROR: FRAME option GROUPS is not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use FRAME option GROUPS with row pattern recognition
 -- Starting with N PRECEDING
 SELECT COUNT(*) OVER w
 FROM rpr_frame
@@ -494,7 +494,7 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
-ERROR:  FRAME must start at CURRENT ROW when row pattern recognition is used
+ERROR:  FRAME must start at CURRENT ROW when using row pattern recognition
 LINE 5:     ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING
             ^
 DETAIL:  Current frame starts with offset PRECEDING.
@@ -509,7 +509,7 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
-ERROR:  FRAME must start at CURRENT ROW when row pattern recognition is used
+ERROR:  FRAME must start at CURRENT ROW when using row pattern recognition
 LINE 5:     ROWS BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING
             ^
 DETAIL:  Current frame starts with offset FOLLOWING.
@@ -637,11 +637,11 @@ WINDOW w AS (
     DEFINE A AS val >= 0, B AS val >= 0
 )
 ORDER BY id;
-ERROR:  FRAME option RANGE is not permitted when row pattern recognition is used
+ERROR:  cannot use FRAME option RANGE with row pattern recognition
 LINE 5:     RANGE BETWEEN CURRENT ROW AND 10 FOLLOWING
             ^
 HINT:  Use ROWS instead.
--- Expected: ERROR: FRAME option RANGE is not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use FRAME option RANGE with row pattern recognition
 -- GROUPS frame with RPR (not permitted)
 SELECT id, val, COUNT(*) OVER w as cnt
 FROM rpr_frame
@@ -653,11 +653,11 @@ WINDOW w AS (
     DEFINE A AS val >= 0, B AS val >= 0
 )
 ORDER BY id;
-ERROR:  FRAME option GROUPS is not permitted when row pattern recognition is used
+ERROR:  cannot use FRAME option GROUPS with row pattern recognition
 LINE 5:     GROUPS BETWEEN CURRENT ROW AND 1 FOLLOWING
             ^
 HINT:  Use ROWS instead.
--- Expected: ERROR: FRAME option GROUPS is not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use FRAME option GROUPS with row pattern recognition
 DROP TABLE rpr_frame;
 -- ============================================================
 -- PARTITION BY + FRAME Tests
@@ -702,11 +702,11 @@ WINDOW w AS (
     DEFINE A AS val >= 10, B AS val >= 20
 )
 ORDER BY id;
-ERROR:  FRAME option RANGE is not permitted when row pattern recognition is used
+ERROR:  cannot use FRAME option RANGE with row pattern recognition
 LINE 6:     RANGE BETWEEN CURRENT ROW AND 10 FOLLOWING
             ^
 HINT:  Use ROWS instead.
--- Expected: ERROR: FRAME option RANGE is not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use FRAME option RANGE with row pattern recognition
 DROP TABLE rpr_partition;
 -- ============================================================
 -- PATTERN Syntax Tests
@@ -1710,10 +1710,10 @@ WINDOW w AS (
         B AS val > PREV(val)
 )
 ORDER BY id;
-ERROR:  prev can only be used in a DEFINE clause
+ERROR:  cannot use prev outside a DEFINE clause
 LINE 1: SELECT PREV(id), id, val, COUNT(*) OVER w as cnt
                ^
--- Expected: ERROR: prev can only be used in a DEFINE clause
+-- Expected: ERROR: cannot use prev outside a DEFINE clause
 -- NEXT function cannot be used other than in DEFINE
 SELECT NEXT(id), id, val, COUNT(*) OVER w as cnt
 FROM rpr_nav
@@ -1726,10 +1726,10 @@ WINDOW w AS (
         B AS val > PREV(val)
 )
 ORDER BY id;
-ERROR:  next can only be used in a DEFINE clause
+ERROR:  cannot use next outside a DEFINE clause
 LINE 1: SELECT NEXT(id), id, val, COUNT(*) OVER w as cnt
                ^
--- Expected: ERROR: next can only be used in a DEFINE clause
+-- Expected: ERROR: cannot use next outside a DEFINE clause
 -- FIRST function - reference match_start row
 SELECT id, val, COUNT(*) OVER w as cnt
 FROM rpr_nav
@@ -1795,16 +1795,16 @@ ORDER BY id;
 
 -- FIRST function cannot be used other than in DEFINE
 SELECT FIRST(id), id, val FROM rpr_nav;
-ERROR:  first can only be used in a DEFINE clause
+ERROR:  cannot use first outside a DEFINE clause
 LINE 1: SELECT FIRST(id), id, val FROM rpr_nav;
                ^
--- Expected: ERROR: first can only be used in a DEFINE clause
+-- Expected: ERROR: cannot use first outside a DEFINE clause
 -- LAST function cannot be used other than in DEFINE
 SELECT LAST(id), id, val FROM rpr_nav;
-ERROR:  last can only be used in a DEFINE clause
+ERROR:  cannot use last outside a DEFINE clause
 LINE 1: SELECT LAST(id), id, val FROM rpr_nav;
                ^
--- Expected: ERROR: last can only be used in a DEFINE clause
+-- Expected: ERROR: cannot use last outside a DEFINE clause
 DROP TABLE rpr_nav;
 -- ============================================================
 -- SKIP TO / INITIAL Tests
@@ -3272,7 +3272,7 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS PREV(FIRST(PREV(v))) > 0
 );
-ERROR:  row pattern navigation cannot be nested more than two levels deep
+ERROR:  cannot nest row pattern navigation more than two levels deep
 LINE 6:     DEFINE A AS PREV(FIRST(PREV(v))) > 0
                         ^
 HINT:  Only PREV(FIRST()), PREV(LAST()), NEXT(FIRST()), and NEXT(LAST()) compound forms are allowed.
diff --git a/src/test/regress/sql/rpr_base.sql b/src/test/regress/sql/rpr_base.sql
index f9d5aa89d7a..90b1ae96a0e 100644
--- a/src/test/regress/sql/rpr_base.sql
+++ b/src/test/regress/sql/rpr_base.sql
@@ -351,7 +351,7 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
--- Expected: ERROR: EXCLUDE options are not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use EXCLUDE options with row pattern recognition
 
 -- EXCLUDE GROUP not permitted
 SELECT COUNT(*) OVER w
@@ -363,7 +363,7 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
--- Expected: ERROR: EXCLUDE options are not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use EXCLUDE options with row pattern recognition
 
 -- EXCLUDE TIES not permitted
 SELECT COUNT(*) OVER w
@@ -375,7 +375,7 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
--- Expected: ERROR: EXCLUDE options are not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use EXCLUDE options with row pattern recognition
 
 -- RANGE frame not starting at CURRENT ROW
 SELECT COUNT(*) OVER w
@@ -386,7 +386,7 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
--- Expected: ERROR: FRAME option RANGE is not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use FRAME option RANGE with row pattern recognition
 
 -- GROUPS frame not starting at CURRENT ROW
 SELECT COUNT(*) OVER w
@@ -397,7 +397,7 @@ WINDOW w AS (
     PATTERN (A+)
     DEFINE A AS val > 0
 );
--- Expected: ERROR: FRAME option GROUPS is not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use FRAME option GROUPS with row pattern recognition
 
 -- Starting with N PRECEDING
 SELECT COUNT(*) OVER w
@@ -504,7 +504,7 @@ WINDOW w AS (
     DEFINE A AS val >= 0, B AS val >= 0
 )
 ORDER BY id;
--- Expected: ERROR: FRAME option RANGE is not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use FRAME option RANGE with row pattern recognition
 
 -- GROUPS frame with RPR (not permitted)
 SELECT id, val, COUNT(*) OVER w as cnt
@@ -517,7 +517,7 @@ WINDOW w AS (
     DEFINE A AS val >= 0, B AS val >= 0
 )
 ORDER BY id;
--- Expected: ERROR: FRAME option GROUPS is not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use FRAME option GROUPS with row pattern recognition
 
 DROP TABLE rpr_frame;
 
@@ -557,7 +557,7 @@ WINDOW w AS (
     DEFINE A AS val >= 10, B AS val >= 20
 )
 ORDER BY id;
--- Expected: ERROR: FRAME option RANGE is not permitted when row pattern recognition is used
+-- Expected: ERROR: cannot use FRAME option RANGE with row pattern recognition
 
 DROP TABLE rpr_partition;
 
@@ -1262,7 +1262,7 @@ WINDOW w AS (
         B AS val > PREV(val)
 )
 ORDER BY id;
--- Expected: ERROR: prev can only be used in a DEFINE clause
+-- Expected: ERROR: cannot use prev outside a DEFINE clause
 
 -- NEXT function cannot be used other than in DEFINE
 SELECT NEXT(id), id, val, COUNT(*) OVER w as cnt
@@ -1276,7 +1276,7 @@ WINDOW w AS (
         B AS val > PREV(val)
 )
 ORDER BY id;
--- Expected: ERROR: next can only be used in a DEFINE clause
+-- Expected: ERROR: cannot use next outside a DEFINE clause
 
 -- FIRST function - reference match_start row
 SELECT id, val, COUNT(*) OVER w as cnt
@@ -1319,11 +1319,11 @@ ORDER BY id;
 
 -- FIRST function cannot be used other than in DEFINE
 SELECT FIRST(id), id, val FROM rpr_nav;
--- Expected: ERROR: first can only be used in a DEFINE clause
+-- Expected: ERROR: cannot use first outside a DEFINE clause
 
 -- LAST function cannot be used other than in DEFINE
 SELECT LAST(id), id, val FROM rpr_nav;
--- Expected: ERROR: last can only be used in a DEFINE clause
+-- Expected: ERROR: cannot use last outside a DEFINE clause
 
 DROP TABLE rpr_nav;
 
-- 
2.50.1 (Apple Git-155)