Re: TODO items for window functions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: TODO items for window functions
Date
Msg-id 10133.1230574772@sss.pgh.pa.us
Whole thread Raw
In response to Re: TODO items for window functions  ("Hitoshi Harada" <umi.tanuki@gmail.com>)
Responses Re: TODO items for window functions  ("Hitoshi Harada" <umi.tanuki@gmail.com>)
List pgsql-hackers
"Hitoshi Harada" <umi.tanuki@gmail.com> writes:
> 2008/12/30 Tom Lane <tgl@sss.pgh.pa.us>:
>> What is the difference?  AFAICS the RANGE and ROWS keywords ought to be
>> equivalent if you are not specifying "expression PRECEDING" or
>> "expression FOLLOWING".

> The difference is that RANGE ... CURRENT ROW contains all peers of the
> current row, while ROWS ... CURRENT ROW doesn't contain them but the
> current row itself only. See 7.11 rule 5-b.

Hah, I had missed that fine point.  Okay, doc is wrong and I will fix.

Given that, I think that a suitable minimum implementation should cover
both the RANGE/ROWS distinction and the CURRENT ROW/UNBOUNDED FOLLOWING
distinction, ie I would like 8.4 to support
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROWRANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWINGROWS BETWEEN
UNBOUNDEDPRECEDING AND CURRENT ROWROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
 

(1 is the default, 2 and 4 behave the same unless I'm still missing
something.)  This doesn't seem too difficult to consider adding now,
and it will greatly increase the usefulness of frame-dependent
window functions.

Is this something you're interested in working on?  I can tackle it
if you don't have time now.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Hitoshi Harada"
Date:
Subject: Re: TODO items for window functions
Next
From: "Hitoshi Harada"
Date:
Subject: Re: TODO items for window functions