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 1taqh9-005ipJ-0S for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2025 06:28:03 +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 1taqh7-00Aybo-PW for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2025 06:28:01 +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.94.2) (envelope-from ) id 1taqh7-00Aybg-GC for pgsql-hackers@lists.postgresql.org; Thu, 23 Jan 2025 06:28:01 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1taqh4-0012cC-21 for pgsql-hackers@postgresql.org; Thu, 23 Jan 2025 06:28:01 +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=dphxX7mvkuphmhgVDOjMCGGeKqBEOMpQ2Twzdr9uu7g=; b=DdAGg/a+6y9y1rFna8Lso4zKz+ H1zkljE6ZfHx0SQ2giX/1IfmmPmIYxw5fClv2EO6/+jUft9zwWtkTNlLYMydhM0cYGd4gv7vlfTxd aDwrripK/b7CM5/nXbv8VLGZWTRba5gxYyAw8FmOsf2CshMf5NZY54DTZDgOGCDP6ib4OrHw3aIdi cTOC+2mXRNyXaMTqxupJUkGSTSEbX6mWkB0AVojXMdCjEGWOJ3NY0EmDHUXa1WxyNOwNhoJVBbYpa U+MMg9cOQ57yKs5LIEbZJcF50T+PClevnf611rvXNF+hb2lAtVWbe6u2e9v0tnhF2qqlPqa6JUVBS yatcugYQ==; Received: from [2409:11:4120:300:c386:abaf:5373:1d14] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from ) id 1taqgz-00BbuJ-Uf; Thu, 23 Jan 2025 06:27:56 +0000 Date: Thu, 23 Jan 2025 15:27:41 +0900 (JST) Message-Id: <20250123.152741.1191357484211664332.ishii@postgresql.org> To: krasiyan@gmail.com Cc: ojford@gmail.com, tgl@sss.pgh.pa.us, vik@postgresfriends.org, pgsql-hackers@postgresql.org, andrew@tao11.riddles.org.uk, david@fetter.org Subject: Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options From: Tatsuo Ishii In-Reply-To: References: <20250123.132502.1946260197628893279.ishii@postgresql.org> X-Mailer: Mew version 6.8 on Emacs 26.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:c386:abaf:5373:1d14 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > Hi, > I was able to reproduce exactly the problem, with clean compile > and --enable-cassert: > test=# SELECT x,y,lead(y) IGNORE NULLS OVER (ORDER BY x) FROM > (VALUES(1,NULL),(2,2),(3,NULL)) AS v(x,y); > x | y | lead > ---+---+------ > 1 | | 2 > 2 | 2 | 2 > 3 | | 2 > (3 rows) > > test=# > Also, make check errors out at window test (without --enable-cassert it was > passed in previous compile): Yeah, same here. Another possible problem is, probably the code does not work well if there are multiple partitions. Since win_nonnulls stores currentpos in a partition, when the partition ends, win_nonnulls needs to be reset. Otherwise, it mistakenly represents currentpos in the previous partition. Best reagards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp