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.94.2) (envelope-from ) id 1v5Yn2-008Zw2-UP for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Oct 2025 00:09:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v5Yn1-003zDJ-3W for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Oct 2025 00:09:20 +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.94.2) (envelope-from ) id 1v5Yn0-003zDB-QS for pgsql-hackers@lists.postgresql.org; Mon, 06 Oct 2025 00:09:19 +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.96) (envelope-from ) id 1v5Ymy-000Dxa-2x for pgsql-hackers@lists.postgresql.org; Mon, 06 Oct 2025 00:09:18 +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=QjcabY/3HMR6SJIQ74OVauvVTjJ1AqBCSuKQiXbIcvQ=; b=R1/3vyWCKxuOiBQ5dTmXgayQG2 1goH4vEpmfWtvwtUQBwl88xhZgqZhUFjtwcvSyD4BdtM1EhDvEl7bNqFr4Jj7lQSN7zyojml3NssH BJEns8X/VwiDAuoiMNVPUQmUoMOvNZcrh4ibCYs29ErQ7BolaPu+NX0x7JABLaDl8lLduqRZ9AVpF LAzhcgThREz9fy5p2FbEdJrS8gbb8/gXZ/2eKLpWhx6It6eY8cF11MXEnx5GfpFxY7rlhs/NPKPiL j/wG9tSAlWdItbqYxpJj2MlP+/Od4yy4mX5vIYDQCmAdWyIod4Bvde2miD6EMrCJcZoOPqSBtUyjf xdVhzJIg==; Received: from [2409:11:4120:300:8932:6f96:1648:b497] (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 1v5Ymr-001Q1z-1z; Mon, 06 Oct 2025 00:09:11 +0000 Date: Mon, 06 Oct 2025 09:09:01 +0900 (JST) Message-Id: <20251006.090901.2288040209954599522.ishii@postgresql.org> To: tgl@sss.pgh.pa.us Cc: alvherre@kurilemu.de, ojford@gmail.com, peter@eisentraut.org, li.evan.chao@gmail.com, krasiyan@gmail.com, vik@postgresfriends.org, andrew@tao11.riddles.org.uk, david@fetter.org, pgsql-hackers@lists.postgresql.org Subject: Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options From: Tatsuo Ishii In-Reply-To: <1694377.1759683105@sss.pgh.pa.us> References: <202510051612.gw67jlc2iqpw@alvherre.pgsql> <1694377.1759683105@sss.pgh.pa.us> 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:8932:6f96:1648:b497 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > will be exited this time. But there's another thing that is > confusing: the NN_NULL case certainly looks like it's expecting > to exit the loop, but that "break" will only get out of the switch > not the loop. You mean "NN_NOTNULL" case? if (notnull_offset >= notnull_relpos), then following "while (notnull_offset < notnull_relpos)" does not satisfy the continuous condition of the while loop and exits the loop. I can add "goto" to explicitly exit the loop if we want. > Moreover, the NN_NULL case looks like it'd fail > to notice end-of-frame. And it's not entirely clear what the > default case thinks it's doing either. WinGetFuncArgInPartition() does not care about frame, no? > In short, this loop is impossible to understand, and the lack of > comments doesn't help. Even if it's not actually buggy, it > needs to be rewritten in a way that helps readers and compilers > see that it's not buggy. I think it might help to separate the > detection of null-ness and fetching of the datum value (if required) > from the loop control logic. Thanks for the idea. Let me think if I could change the loop to be easier to understand. Best regards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp