Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hvjNt-0002PA-9t for pgsql-general@arkaria.postgresql.org; Thu, 08 Aug 2019 14:27:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hvjNs-0005fz-2v for pgsql-general@arkaria.postgresql.org; Thu, 08 Aug 2019 14:27:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hvjNr-0005dF-LY for pgsql-general@lists.postgresql.org; Thu, 08 Aug 2019 14:27:15 +0000 Received: from mout.kundenserver.de ([212.227.126.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hvjNo-0002rQ-RZ for pgsql-general@lists.postgresql.org; Thu, 08 Aug 2019 14:27:14 +0000 Received: from [10.8.0.6] ([185.40.248.10]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPSA (Nemesis) id 1N4A1h-1iMZky3DFZ-0101Zz for ; Thu, 08 Aug 2019 16:27:09 +0200 Subject: Re: lead() with arrays - strange behaviour To: pgsql-general@lists.postgresql.org References: <4f2f232b-7f3f-4d69-e448-2944e10682e7@gmx.net> <13848.1565273434@sss.pgh.pa.us> From: Thomas Kellerer Message-ID: Date: Thu, 8 Aug 2019 16:27:09 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 In-Reply-To: <13848.1565273434@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit X-Provags-ID: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63IYVop5XUU1w= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tom Lane schrieb am 08.08.2019 um 16:10: > David's point is that the two occurrences of lead() don't mean the > same thing. A window function is directly tied to the SELECT that > it is in the select-list of, and its notion of next and previous > rows is concerned with the set of rows that that SELECT's FROM-clause > generates. In this example, the inner SELECT has an empty FROM that > returns one row, so the lead() in that SELECT doesn't do anything > useful. Ah! Now I get it ;) Thanks for clearing that up. > You could probably get where you want to go with something along > the lines of Yes, that's what I did in the end (see my initial post)