Обсуждение: WIP patch for basic window frame support
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
Вложения
2008/12/31 Tom Lane <tgl@sss.pgh.pa.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
2009/1/5 Tom Lane <tgl@sss.pgh.pa.us>: > "Hitoshi Harada" <umi.tanuki@gmail.com> writes: >> 2008/12/31 Tom Lane <tgl@sss.pgh.pa.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
"Hitoshi Harada" <umi.tanuki@gmail.com> writes: > 2008/12/31 Tom Lane <tgl@sss.pgh.pa.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