Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1efT8C-0005PX-GX for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Jan 2018 16:15:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1efT8A-0004s6-U5 for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Jan 2018 16:15:02 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1efT8A-0004rl-Jw for pgsql-hackers@lists.postgresql.org; Sat, 27 Jan 2018 16:15:02 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1efT84-0004wI-3R for pgsql-hackers@postgresql.org; Sat, 27 Jan 2018 16:15:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w0RGErjp027789; Sat, 27 Jan 2018 11:14:53 -0500 From: Tom Lane To: Oliver Ford cc: Erik Rijkers , Pg Hackers Subject: Re: Add RANGE with values and exclusions clauses to the Window Functions In-reply-to: References: <2c084c1c2bf599ceb2afa87874de8bc1@xs4all.nl> <13279.1515535159@sss.pgh.pa.us> <4139.1515567978@sss.pgh.pa.us> Comments: In-reply-to Oliver Ford message dated "Sat, 27 Jan 2018 10:49:46 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27787.1517069693.1@sss.pgh.pa.us> Date: Sat, 27 Jan 2018 11:14:53 -0500 Message-ID: <27788.1517069693@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Oliver Ford writes: > On Sat, Jan 27, 2018 at 7:40 AM, Erik Rijkers wrote: >> Regression tests only succeed for assert-disabled compiles; they fail when >> assert-enabled: > Problem seems to be with an existing Assert in catcache.c:1545: > Assert(nkeys > 0 && nkeys < cache->cc_nkeys); > The "<" needs to be "<=" (and is changed in the attached patch). No, that Assert is correct, because it's in SearchCatCacheList. It doesn't make any sense to use SearchCatCacheList for a lookup that specifies all of the key columns, because then you necessarily have at most one match; you might as well use regular SearchCatCache, which is significantly more efficient. > AFAICT this was never a problem before purely because no code before > this patch called SearchSysCacheList4, so they always called with > fewer keys than the number available. Hm, probably we shouldn't even have that macro. regards, tom lane