diff --git a/src/backend/parser/parse_rpr.c b/src/backend/parser/parse_rpr.c index 048e84bd7bd..cc693b36208 100644 --- a/src/backend/parser/parse_rpr.c +++ b/src/backend/parser/parse_rpr.c @@ -68,6 +68,25 @@ transformRPR(ParseState *pstate, WindowClause *wc, WindowDef *windef, return; /* Check Frame options */ + + /* Frame type must be "ROW" */ + if (wc->frameOptions & FRAMEOPTION_GROUPS) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("FRAME option GROUP is not permitted when row pattern recognition is used"), + errhint("Use: ROWS insted"), + parser_errposition(pstate, + windef->frameLocation >= 0 ? + windef->frameLocation : windef->location))); + if (wc->frameOptions & FRAMEOPTION_RANGE) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("FRAME option RANGE is not permitted when row pattern recognition is used"), + errhint("Use: ROWS insted"), + parser_errposition(pstate, + windef->frameLocation >= 0 ? + windef->frameLocation : windef->location))); + /* Frame must start at current row */ if ((wc->frameOptions & FRAMEOPTION_START_CURRENT_ROW) == 0) {