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.98.2) (envelope-from ) id 1xQD7P-00000001FqM-2kCY for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Nov 2026 00:20:17 +0000 Received: from localhost ([127.0.0.1]:43250 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xQD7P-00000007HO3-3JQW for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Nov 2026 00:20:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:33450) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xQD7P-00000007HNv-1fd7 for pgsql-bugs@lists.postgresql.org; Mon, 09 Nov 2026 00:20:15 +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 1xQD7L-00000000viW-2EGq for pgsql-bugs@lists.postgresql.org; Mon, 09 Nov 2026 00:20:14 +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=Od6zYG74X19kmvDM51bzrd+XFufnLMWlUegmv23kBng=; b=NRC6ZZ8Q6ndZR0BIN6Ufxza/4Y /F37JRZ7OC9fl/qIm8P52p6JPDTREI+lGpVjeG9R4/tY5zihwyClu/a/uNVnYTg2K/+EyhEurJhoA A/JGsRt/1XnIIAYyRRO0NKJSMT2LWUFl8qcwA18M/7uWBl+9ePbq4Fnlchqr5EDqzAx+U0EX3EXcP doy2ZC7D6EJU1ap6Q+mTe2zcIOItVvWk83zC/vt7X8OCDhA4DCf3uYXme7EI/UARAW1JrrPAi3f7X k9HQjwJD7aBWJ0H4MX2uz7NpUwUe+CAbZ01E3WTo4zLEG6BIt2yQ+HFoftLOJIQhsw+OMBlEvbZqd xpx3hIwQ==; Received: from [2409:11:4120:300:c305:38b4:f8fd:3dc7] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xQD7D-000000026u2-3ijc; Mon, 09 Nov 2026 00:20:06 +0000 Date: Mon, 09 Nov 2026 09:19:50 +0900 (JST) Message-Id: <20261109.091950.2016703765973000585.ishii@postgresql.org> To: zhong950419@gmail.com Cc: masao.fujii@gmail.com, c.bhuvan@iitg.ac.in, pgsql-bugs@lists.postgresql.org Subject: Re: first_value()/nth_value() with IGNORE NULLS loop forever (EXCLUDE GROUP/TIES, frame past partition end, no ORDER BY) From: Tatsuo Ishii In-Reply-To: References: <20261107.091833.1799286331446051531.ishii@postgresql.org> 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:c305:38b4:f8fd:3dc7 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > I agree about nth_value() with RESPECT NULLS. It has always worked > this way. > > But for ROWS frames row_is_in_frame() can tell from the position > alone that the row is out of frame. The attached patch moves that call > back in front of the partition end check. Fujii-san's query returns > NULL again, and the loop from the original report still ends. Thanks for the patch. I had thought about a similar fix but still am not convinced it's worth the trouble. Let's continue the discussion on it after 19 GA is out. Regards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp