> Hi Henson,
> 
> In my understanding RANGE/GROUPS are not allowed when RPR is defined.
> (See ISO/IEC 19075-5 section 6.10.2 "ROWS BETWEEN CURRENT ROW AND").
> So proper fix would be to error out at the parse/analyze phase if
> RANGE/GROUPS are used when RPR is defined.

Attached is a patch to disallow RANGE/GROUPS when RPR is used. On top
of your last patches.

Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
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)
        {

Reply via email to