Re: Row pattern recognition

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: david(dot)g(dot)johnston(at)gmail(dot)com, jacob(dot)champion(at)enterprisedb(dot)com, er(at)xs4all(dot)nl, peter(at)eisentraut(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Row pattern recognition
Date: 2025-11-18 11:19:46
Message-ID: 59fe567f-ba41-4cc2-b04a-a830288ea929@postgresfriends.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 18/11/2025 06:03, Chao Li wrote:
> 1 - 0001 - kwlist.h
> ```
> +PG_KEYWORD("define", DEFINE, RESERVED_KEYWORD, BARE_LABEL)
> ```
>
> Why do we add “define” as a reserved keyword? From the SQL example you put in 0006:
> ```
> <programlisting>
> SELECT company, tdate, price,
> first_value(price) OVER w,
> max(price) OVER w,
> count(price) OVER w
> FROM stock
> WINDOW w AS (
> PARTITION BY company
> ORDER BY tdate
> ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING
> AFTER MATCH SKIP PAST LAST ROW
> INITIAL
> PATTERN (LOWPRICE UP+ DOWN+)
> DEFINE
> LOWPRICE AS price &lt;= 100,
> UP AS price &gt; PREV(price),
> DOWN AS price &lt; PREV(price)
> );
> </programlisting>
> ```
>
> PARTITION is at the same level as DEFINE, but it’s not defined as a reserved keyword:
> ```
> PG_KEYWORD("partition", PARTITION, UNRESERVED_KEYWORD, BARE_LABEL)
> ```
>
> Even in this patch,”initial”,”past”, “pattern” and “seek” are defined as unreserved, why?
>
> So I just want to clarify.

Because of position. Without making DEFINE a reserved keyword, how do
you know that it isn't another variable in the PATTERN clause?

--

Vik Fearing

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message r314tive 2025-11-18 11:55:00 Re: Ambiguity in IS JSON description and logic
Previous Message shveta malik 2025-11-18 11:17:14 Re: Proposal: Conflict log history table for Logical Replication