Re: WIP patch for basic window frame support

Lists: pgsql-hackers
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Hitoshi Harada" <umi(dot)tanuki(at)gmail(dot)com>, "David Rowley" <dgrowley(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: WIP patch for basic window frame support
Date: 2008-12-30 20:49:51
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

No docs or regression tests yet, but it seems to work ... please check
against Oracle and DB2 behavior. Supported cases are

RANGE UNBOUNDED PRECEDING -- same as AND CURRENT ROW
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
ROWS UNBOUNDED PRECEDING -- same as AND CURRENT ROW
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING

regards, tom lane

Attachment Content-Type Size
window-frames-1.patch.gz application/octet-stream 13.4 KB

From: "Hitoshi Harada" <umi(dot)tanuki(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David Rowley" <dgrowley(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for basic window frame support
Date: 2009-01-05 00:16:23
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

2008/12/31 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> No docs or regression tests yet, but it seems to work ... please check
> against Oracle and DB2 behavior. Supported cases are
>
> RANGE UNBOUNDED PRECEDING -- same as AND CURRENT ROW
> ROWS UNBOUNDED PRECEDING -- same as AND CURRENT ROW

Is this true?
I guess that the 7.11 rule 5.b in the spec says as far as the bound is
not specified in the window frame clause, all rows of the partition
are contained in the frame. The rule then removes rows from the
initial frame as the frame bound indicates.

So as the result,
RANGE UNBOUNDED PRECEDING
ROWS UNBOUNDED PRECEDING
both mean
(RANGE / ROWS) BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
if I don't miss something.

Regards,

--
Hitoshi Harada


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Hitoshi Harada" <umi(dot)tanuki(at)gmail(dot)com>
Cc: "David Rowley" <dgrowley(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for basic window frame support
Date: 2009-01-05 00:34:53
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

"Hitoshi Harada" <umi(dot)tanuki(at)gmail(dot)com> writes:
> 2008/12/31 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> RANGE UNBOUNDED PRECEDING -- same as AND CURRENT ROW
>> ROWS UNBOUNDED PRECEDING -- same as AND CURRENT ROW

> Is this true?

7.11 syntax rule 9 says so. AFAICS general rule 5b doesn't discuss the
case where <window frame bound 2> isn't present, and doesn't need to
because of syntax rule 9.

regards, tom lane


From: "Hitoshi Harada" <umi(dot)tanuki(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David Rowley" <dgrowley(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for basic window frame support
Date: 2009-01-05 00:52:49
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

2009/1/5 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> "Hitoshi Harada" <umi(dot)tanuki(at)gmail(dot)com> writes:
>> 2008/12/31 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>> RANGE UNBOUNDED PRECEDING -- same as AND CURRENT ROW
>>> ROWS UNBOUNDED PRECEDING -- same as AND CURRENT ROW
>
>> Is this true?
>
> 7.11 syntax rule 9 says so. AFAICS general rule 5b doesn't discuss the
> case where <window frame bound 2> isn't present, and doesn't need to
> because of syntax rule 9.
>

OK, I've just found it and confirmed Oracle does so.

--
Hitoshi Harada