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 1wasTa-0027uG-1n for pgsql-hackers@arkaria.postgresql.org; Sat, 20 Jun 2026 09:58:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wasTX-001ByO-36 for pgsql-hackers@arkaria.postgresql.org; Sat, 20 Jun 2026 09:58:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wasTX-001ByF-1e for pgsql-hackers@lists.postgresql.org; Sat, 20 Jun 2026 09:58:55 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wasTU-00000001GtV-1Q0I for pgsql-hackers@postgresql.org; Sat, 20 Jun 2026 09:58:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:Cc:To:Message-Id:Date:Sender :Reply-To:Content-ID:Content-Description; bh=YcWwhH1BtBJtN9qZ+C086Jx3eobXC9y1GI1fIP7CEMI=; b=hFt5HD9u/GaIrRKXRLIfgQV092 bzF1NLJh3i2XglcMx6rbVU1t4GmOSjhAlqZjSTTwD4+lNva9W16zmmTQrKm5uhyCZcje1SFfvM0HE xtT3+HNzxlfmp8K6rmWqgGxuxvClTM5y+nKP5gBA+0TRFa3G7g0ALZIdqA/o+WU9B8MNefRWVP8F3 2EDe/DGXaDOcGt+0fcZZJEgt1cpO1VUAa2v7WOUSWEjHV4ncyhyRorbcwLhPWBJjREYkLsH1be1Si Z3RnQE4Xu5y1qpXMN/hkjgzVEd5cAbO9eK/JX0ENb9U0fz6FWsWyLkks+MBgXUi/grAmyS1/KjPmo IxoR/a/g==; Received: from [2409:11:4120:300:7704:6f5d:b2dc:af61] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wasTK-003iwL-0e; Sat, 20 Jun 2026 09:58:44 +0000 Date: Sat, 20 Jun 2026 18:58:25 +0900 (JST) Message-Id: <20260620.185825.525530614716872063.ishii@postgresql.org> To: assam258@gmail.com Cc: jian.universality@gmail.com, zsolt.parragi@percona.com, sjjang112233@gmail.com, vik@postgresfriends.org, er@xs4all.nl, jacob.champion@enterprisedb.com, david.g.johnston@gmail.com, peter@eisentraut.org, li.evan.chao@gmail.com, pgsql-hackers@postgresql.org Subject: Re: Row pattern recognition From: Tatsuo Ishii In-Reply-To: References: X-Mailer: Mew version 6.8 on Emacs 29.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:11:4120:300:7704:6f5d:b2dc:af61 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Henson, > rest. So evaluating its DEFINE -- option (b) -- would mean running a clause > the standard tells us to ignore. Right. > Agreed, and the parallel is convincing. An unused window already escapes > the negative-frame-offset check, so singling out DEFINE as the one clause > that must fire regardless would be inconsistent with how the rest of an > unused window already behaves. > > This also matches the planner: select_active_windows() drops any window with > no referencing WindowFunc, and its comment already cites the same clause> General Rules (General Rule 4) as its basis. > > Either way, the disregard rule governs only execution. A failure raised in > the parser, transform, rewrite, or planner is a separate, static layer the > rule does not touch. And at execution there is nothing to evaluate: an > unused window is never turned into a WindowAgg node, so its DEFINE is never > reached. Yes, the rule only applies to execution. I think what we do in other phases is implementation dependent. > So I'm convinced -- let's keep (a), the current behavior, and I'll treat > this open question as closed, with no patch change. For the record, the two > halves stay cleanly separated: the RPR DEFINE volatility check still visits > every window clause at preprocessing (independent of select_active_windows), > while run-time DEFINE evaluation happens only for windows that survive it. > > Thanks for digging up the standard text. You are welcome. Please feel free to ask me if you want to know what 9075-2 says about someting. Regards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp