Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZASu-00036y-1F for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jan 2018 07:06:24 +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 1eZASt-0001rg-CH for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jan 2018 07:06:23 +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 1eZASt-0001rW-2K for pgsql-hackers@lists.postgresql.org; Wed, 10 Jan 2018 07:06:23 +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 1eZASq-0003ao-IQ for pgsql-hackers@postgresql.org; Wed, 10 Jan 2018 07:06:21 +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 w0A76IUq004140; Wed, 10 Jan 2018 02:06:18 -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> Comments: In-reply-to Oliver Ford message dated "Wed, 10 Jan 2018 06:56:41 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4138.1515567978.1@sss.pgh.pa.us> Date: Wed, 10 Jan 2018 02:06:18 -0500 Message-ID: <4139.1515567978@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Oliver Ford writes: > On Tuesday, 9 January 2018, Tom Lane wrote: >> So the approach I'm imagining now is a datatype-specific support function >> along the lines of >> in_range(a, b, delta) returns bool >> Likely there are two of these, one each for the PRECEDING and FOLLOWING >> cases. > Would you prefer two functions, or a single function with a parameter for > PRECEDING/FOLLOWING? Maybe: > in_range(a, b, delta, following) returns bool You could do it that way too. The two-function approach seems a little cleaner and easier to document IMO, but it would create more catalog bloat, so there's that. I don't have a strong preference. regards, tom lane