Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vLJkY-00CERn-08 for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Nov 2025 11:19:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vLJkW-005n6E-2G for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Nov 2025 11:19:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vLJkW-005n66-12 for pgsql-hackers@lists.postgresql.org; Tue, 18 Nov 2025 11:19:52 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vLJkT-000AMV-2K; Tue, 18 Nov 2025 11:19:52 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 8D8581F74A; Tue, 18 Nov 2025 11:19:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=postgresfriends.org; s=gm1; t=1763464787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dxRJ0PNUbrHBcS3lM3Ez65/pd3Aq5oCPyvuXPLb6wzA=; b=WFKL1mC6Dm6yTWkWa8alIYHcZV+YNQj42WYreuXF3mehkHs2msV37updpQK7h57cziGPbV gv0zrQwbKOKHnJt7pWjxZie1WDNQK/OhOgw0XKrU5x0/MIPfq720UTdmmC2RFQ/Ab2vh9t gQQ/QZwePiw0jwYz4QinYjoIUmEa0k6AVGAS9Wo88epEmB5x359doaTFYRIpIr7zqD7hCS ohoqlHMJdIMsfBeT57LVwuRzuH0Su3NxKtsKYG7CcsnZxAXQXipeMMkQxFnoh+hz3IttUS JMfjUB+j3R5n0brqyPl4gjkOqaHqSRsGNNkjv8g2uz/iKFWTYUkbbMC6Y9VNjQ== Message-ID: <59fe567f-ba41-4cc2-b04a-a830288ea929@postgresfriends.org> Date: Tue, 18 Nov 2025 12:19:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Row pattern recognition To: Chao Li , Tatsuo Ishii Cc: david.g.johnston@gmail.com, jacob.champion@enterprisedb.com, er@xs4all.nl, peter@eisentraut.org, pgsql-hackers@postgresql.org 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> Content-Language: en-US From: Vik Fearing In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvvdduudekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomhepgghikhcuhfgvrghrihhnghcuoehvihhksehpohhsthhgrhgvshhfrhhivghnughsrdhorhhgqeenucggtffrrghtthgvrhhnpedutdevfeelgedvuddtjefhhfelhefhveehieelhfegtedtuefhtdffgedvgfetffenucfkphepvdgrtddvmeekgedvkeemudduvgdtmedvjedtudemfheggegumeegjehfkeemgegsleegmeegkedvtgenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvrgdtvdemkeegvdekmeduudgvtdemvdejtddumehfgeegugemgeejfhekmeegsgelgeemgeekvdgtpdhhvghloheplgfkrfggieemvdgrtddvmeekgedvkeemudduvgdtmedvjedtudemfheggegumeegjehfkeemgegsleegmeegkedvtggnpdhmrghilhhfrhhomhepvhhikhesphhoshhtghhrvghsfhhrihgvnhgushdrohhrghdpnhgspghrtghpthhtohepjedprhgtphhtthhopehlihdrvghvrghnrdgthhgrohesghhmrghilhdrtghomhdprhgtphhtthhopehishhhihhisehpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopegur ghvihgurdhgrdhjohhhnhhsthhonhesghhmrghilhdrtghomhdprhgtphhtthhopehjrggtohgsrdgthhgrmhhpihhonhesvghnthgvrhhprhhishgvuggsrdgtohhmpdhrtghpthhtohepvghrseigshegrghllhdrnhhlpdhrtghpthhtohepphgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhg X-GND-Sasl: vik@postgresfriends.org List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: > ``` > > 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) > ); > > ``` > > 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