Re: Row pattern recognition

From: NINGWEI CHEN <chen(at)sraoss(dot)co(dot)jp>
To: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Row pattern recognition
Date: 2024-01-22 05:51:49
Message-ID: 20240122145149.3e8bde1f384b303533c990a3@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 09 Dec 2023 07:22:58 +0900 (JST)
Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> wrote:

> > On 04.12.23 12:40, Tatsuo Ishii wrote:
> >> diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
> >> index d631ac89a9..5a77fca17f 100644
> >> --- a/src/backend/parser/gram.y
> >> +++ b/src/backend/parser/gram.y
> >> @@ -251,6 +251,8 @@ static Node *makeRecursiveViewSelect(char
> >> *relname, List *aliases, Node *query);
> >> DefElem *defelt;
> >> SortBy *sortby;
> >> WindowDef *windef;
> >> + RPCommonSyntax *rpcom;
> >> + RPSubsetItem *rpsubset;
> >> JoinExpr *jexpr;
> >> IndexElem *ielem;
> >> StatsElem *selem;
> >> @@ -278,6 +280,7 @@ static Node *makeRecursiveViewSelect(char
> >> *relname, List *aliases, Node *query);
> >> MergeWhenClause *mergewhen;
> >> struct KeyActions *keyactions;
> >> struct KeyAction *keyaction;
> >> + RPSkipTo skipto;
> >> }
> >> %type <node> stmt toplevel_stmt schema_stmt routine_body_stmt
> >
> > It is usually not the style to add an entry for every node type to the
> > %union. Otherwise, we'd have hundreds of entries in there.
>
> Ok, I have removed the node types and used existing node types. Also
> I have moved RPR related %types to same place to make it easier to know
> what are added by RPR.
>
> >> @@ -866,6 +878,7 @@ static Node *makeRecursiveViewSelect(char
> >> *relname, List *aliases, Node *query);
> >> %nonassoc UNBOUNDED /* ideally would have same precedence as IDENT */
> >> %nonassoc IDENT PARTITION RANGE ROWS GROUPS PRECEDING FOLLOWING CUBE
> >> %ROLLUP
> >> SET KEYS OBJECT_P SCALAR VALUE_P WITH WITHOUT
> >> +%nonassoc MEASURES AFTER INITIAL SEEK PATTERN_P
> >> %left Op OPERATOR /* multi-character ops and user-defined operators */
> >> %left '+' '-'
> >> %left '*' '/' '%'
> >
> > It was recently discussed that these %nonassoc should ideally all have
> > the same precedence. Did you consider that here?
>
> No, I didn't realize it. Thanks for pointing it out. I have removed
> %nonassoc so that MEASURES etc. have the same precedence as IDENT etc.
>
> Attached is the new diff of gram.y against master branch.

Thank you very much for providing the patch for the RPR implementation.

After applying the v12-patches, I noticed an issue that
the rpr related parts in window clauses were not displayed in the
view definitions (the definition column of pg_views).

To address this, I have taken the liberty of adding an additional patch
that modifies the relevant rewriter source code.
I have attached the rewriter patch for your review and would greatly appreciate your feedback.

Thank you for your time and consideration.

--
SRA OSS LLC
Ningwei Chen <chen(at)sraoss(dot)co(dot)jp>
TEL: 03-5979-2701 FAX: 03-5979-2702

Attachment Content-Type Size
rewriter-patch.txt text/plain 4.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2024-01-22 05:55:07 Re: remaining sql/json patches
Previous Message Peter Smith 2024-01-22 05:50:13 Re: Relation bulk write facility