Re: Add RANGE with values and exclusions clauses to the Window Functions

From: Oliver Ford <ojford(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Erik Rijkers <er(at)xs4all(dot)nl>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add RANGE with values and exclusions clauses to the Window Functions
Date: 2018-01-10 06:56:41
Message-ID: CAGMVOdtYSNJusckQ_9vBkMsZBQzan=Uw-Z-uYG2fD9rZ2TP7pA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tuesday, 9 January 2018, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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
>
> which is supposed to return true if a <= b + delta, or something along
> that line --- exact details of the definition TBD --- with the proviso
> that if b + delta would overflow then the result is automatically true.
>
> We could probably also delegate the requirement of throwing an error
> for negative delta to this function, eliminating the need for the
> datatype-independent core code to know how to tell that, which is the
> other datatype-dependent behavior needed per spec.
>
> 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

Where following is a bool which is true if FOLLOWING was specified and
false if PRECEDING was specified?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-01-10 07:06:18 Re: Add RANGE with values and exclusions clauses to the Window Functions
Previous Message Oleg Bartunov 2018-01-10 06:37:30 Re: [HACKERS] SQL/JSON in PostgreSQL