agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Vik Fearing <vik@postgresfriends.org>
To: Chao Li <li.evan.chao@gmail.com>
To: Tatsuo Ishii <ishii@postgresql.org>
Cc: david.g.johnston@gmail.com
Cc: jacob.champion@enterprisedb.com
Cc: er@xs4all.nl
Cc: peter@eisentraut.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: Row pattern recognition
Date: Tue, 18 Nov 2025 12:19:46 +0100
Message-ID: <59fe567f-ba41-4cc2-b04a-a830288ea929@postgresfriends.org> (raw)
In-Reply-To: <DBA30B4B-F611-46AC-807D-027D3CBEDEC9@gmail.com>
References: <20250816.174552.1094782787078410357.ishii@postgresql.org>
<20250924.193523.694296225366690354.ishii@postgresql.org>
<20251117.155715.178271279022552982.ishii@postgresql.org>
<20251118.113320.572888636385647268.ishii@postgresql.org>
<DBA30B4B-F611-46AC-807D-027D3CBEDEC9@gmail.com>
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 <= 100,
> UP AS price > PREV(price),
> DOWN AS price < 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
view thread (523+ messages) latest in thread
Message-ID: <59fe567f-ba41-4cc2-b04a-a830288ea929@postgresfriends.org>
Permalink: ../59fe567f-ba41-4cc2-b04a-a830288ea929@postgresfriends.org/
Also on: postgresql.org/message-id/59fe567f-ba41-4cc2-b04a-a830288ea929@postgresfriends.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: vik@postgresfriends.org, li.evan.chao@gmail.com, ishii@postgresql.org, david.g.johnston@gmail.com, jacob.champion@enterprisedb.com, er@xs4all.nl, peter@eisentraut.org
Subject: Re: Row pattern recognition
In-Reply-To: <59fe567f-ba41-4cc2-b04a-a830288ea929@postgresfriends.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox