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 1v9HL8-00ET3B-4Q for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Oct 2025 06:19:53 +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 1v9HL6-00AJCR-Fl for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Oct 2025 06:19:51 +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 1v9HL6-00AJCH-5j for pgsql-hackers@lists.postgresql.org; Thu, 16 Oct 2025 06:19:51 +0000 Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1v9HL3-0022WE-0a for pgsql-hackers@lists.postgresql.org; Thu, 16 Oct 2025 06:19:50 +0000 Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id 909B914001F1; Thu, 16 Oct 2025 02:19:48 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Thu, 16 Oct 2025 02:19:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1760595588; x=1760681988; bh=qdg7p6NPhA anekiqpfILZ740jo68ffpjgMLXhvn/LJo=; b=Iy5DrQTB+FERiugT/gYGvVOsI6 6u4xCsnLkymZ6YIGHLXoRdcr87k26+KlWv/vxVhRYVOCFtOGSes0tMwUlBqQ5Qjx T9d68S36WpfQKMhry3tmBpEKwk9Rg3ADF8kcLNa1Tvo+QGZQ9qLUzgB2tronCvH7 24THUcLZ+DIV95wCxeXYlxn8UDHwOrQreIciIFHtVozG0NJuA+rRqpk1Ti0lZf9a CRWsJwzh9ct+dAmI77wKTL1acbRqG5iVr0tZw3TjkYgvJnJYJlq8Qt11pQEu+REx hJBAYsIwLeXqfpwltiremrFWONbKInH/Aae+1tNQo6yJ7Wa420facQFqSu1g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1760595588; x=1760681988; bh=qdg7p6NPhAanekiqpfILZ740jo68ffpjgML Xhvn/LJo=; b=sqspTRvPXxR2OicjZbaBlCwzeuzBEVUNl5PRz2UNt5YUvqOeMWs JJjnZK0yq9zlBp2OmJEfnmHygmqmzxmeiY0ydF9wyYaaxLfTEWAwfWMQqSMwlX0e dDm97KsD7Yh2ROLudDlqiQzSxhlrK2MK+QokQSKNDKO4roDg8YuWutUU3/ZrhEVB 0lPNP5FlQ0aq0vO0sW0x2NszhiwnqIp+H0wlWep1Ge6Y4XhR9c3F0GrXMUyoJiT4 yqvbTblGs3oBpkoIHsM+gVMDnp+JOgf8cTeROcbthT2UeGbtlYzvCVCOgqiIyOxf vFYgltZ69cXlw9DVu+Y+y+MHm5tqMHiXlNQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduvdehheeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepuddupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehish hhihhisehpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehlihdrvghvrghnrdgt hhgrohesghhmrghilhdrtghomhdprhgtphhtthhopehtghhlsehsshhsrdhpghhhrdhprg druhhspdhrtghpthhtohepphhrrghmshgvhiestghlvghvvghrvghlvghphhgrnhhtrdgt rgdprhgtphhtthhopehojhhfohhrugesghhmrghilhdrtghomhdprhgtphhtthhopehpvg htvghrsegvihhsvghnthhrrghuthdrohhrghdprhgtphhtthhopehkrhgrshhihigrnhes ghhmrghilhdrtghomhdprhgtphhtthhopehvihhksehpohhsthhgrhgvshhfrhhivghnug hsrdhorhhgpdhrtghpthhtoheprghnughrvgifsehtrghouddurdhrihguughlvghsrdho rhhgrdhukh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Oct 2025 02:19:43 -0400 (EDT) Date: Thu, 16 Oct 2025 15:19:21 +0900 From: Michael Paquier To: Tatsuo Ishii Cc: li.evan.chao@gmail.com, tgl@sss.pgh.pa.us, pramsey@cleverelephant.ca, ojford@gmail.com, peter@eisentraut.org, 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 Message-ID: References: <20251011.144218.1729318385118014326.ishii@postgresql.org> <66A28678-BDC0-4266-9244-74320D578222@gmail.com> <20251013.143941.1447453701514209859.ishii@postgresql.org> <20251014.192113.1554227757626092006.ishii@postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PEnLPnxFFZ/139Ex" Content-Disposition: inline In-Reply-To: <20251014.192113.1554227757626092006.ishii@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --PEnLPnxFFZ/139Ex Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Oct 14, 2025 at 07:21:13PM +0900, Tatsuo Ishii wrote: > V2 patch pushed. Thanks. Coverity thinks that this code has still some incorrect bits, and I think that it is right to think so even on today's HEAD at 02c171f63fca. In WinGetFuncArgInPartition()@nodeWindowAgg.c, we have the following loop (keeping only the relevant parts: do { [...] else /* need to check NULL or not */ { /* get tuple and evaluate in partition */ datum = gettuple_eval_partition(winobj, argno, abs_pos, isnull, &myisout); if (myisout) /* out of partition? */ break; if (!*isnull) notnull_offset++; /* record the row status */ put_notnull_info(winobj, abs_pos, *isnull); } } while (notnull_offset < notnull_relpos); /* get tuple and evaluate in partition */ datum = gettuple_eval_partition(winobj, argno, abs_pos, isnull, &myisout); And Coverity is telling that there is no point in setting a datum in this else condition to just override its value when we exit the while loop. To me, it's a sigh that this code's logic could be simplified. In passing, gettuple_eval_partition() is under-documented for me. Its name refers to the fact that it gets a tuple and evaluates a partition. Its top comment tells the same thing as the name of the function, so it's a bit hard to say why it is useful with the code written this way, and how others many benefit when attempting to reuse it, or if it even makes sense to reuse it for other purposes. -- Michael --PEnLPnxFFZ/139Ex Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmjwjmkACgkQnvQgOdby QH0v6A/+LIimXIbaKdbA7XwpRKDMs2WI0q/XTGky4sXLamVnX2iS/FJWRDCyHFQF aUTxwM3lBSm50ixN2IK6mcBbG9CCYuVxe4q1K2k/AEEaSs2AJSXjzH6dMA8yNymM eu0B7IhAWwI6ow4STKAkD17QuGlheSapXttdjMCK4cIWbqRjZ7RwPpCsrEMQrCju hKqTZnvEpJwQTQn0hI8jBbTKGZdP9m35o21Cji6Q12OqQIfmf+Iu/bXQv+LaaOxO XvBmRT5BekUeeN1D2W8eJax5he6xP/Rx4g0A3JHBpC4ws6JGKvV0HV3S/BUvgrqE 2HMaTdwtw57dqtKJNJbhfWb1flMv62lxSQ7DNeDfb5622MCo0atsb1sEMsTZcQmb Ki1SSHlOCuV4rR86F5IAQ6jSQaVtZUOuvBPp3dZf8XmEkkEp/8/8iNePAbQKV8/2 N6SEHwnIDhSBZF7MYrSJ0Un9lMaVqtThCzFXOn0S0S+CLbPXz2acc5eo8MELXf+7 dC0oLv9CO02wfER9SNHo540vd5oJ805ehf/cDgaFWMZFcLHmtJpgYT/RtdkMkJ8a KaJIi/moyhgmE5PxqA34CtSHXYhGy1FJveVVHP4bn3jMpRawuiW1mfS1LjI906k/ NaxcXcVH8aXEfHC3OJyJJeczEO9QPdALF1n1JQUGgzPaMZo3S/U= =aM+7 -----END PGP SIGNATURE----- --PEnLPnxFFZ/139Ex--