From david.g.johnston@gmail.com Sun May 24 13:52:05 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yd4VH-0007rm-Mt for pgsql-docs@arkaria.postgresql.org; Tue, 31 Mar 2015 22:19:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yd4VG-0003ed-HQ for pgsql-docs@arkaria.postgresql.org; Tue, 31 Mar 2015 22:19:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yd4VF-0003eO-Am for pgsql-docs@postgresql.org; Tue, 31 Mar 2015 22:19:21 +0000 Received: from mail-ie0-x236.google.com ([2607:f8b0:4001:c03::236]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Yd4VA-00079N-Vp for pgsql-docs@postgresql.org; Tue, 31 Mar 2015 22:19:20 +0000 Received: by iedm5 with SMTP id m5so28815979ied.3 for ; Tue, 31 Mar 2015 15:19:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=HcyTxoLHLy4IAppivysmCwyPtEDaDC3wAFr1FJeSA84=; b=iC2E+irUIb/DJaA6p6PEp07tJPHrynMmIBVjmOQjixf/sfUyBdgHx5FzPMFVHq91TI NgU7pfXceAOOkC3lBFRfYa8ICWxiJlI5OfDdxvbWc0+jRFU78RVxpyqA2rI737v/DOed Jc0wk10WwREtKWmirGEhSWAuyTw4wCI7MO3gu5acWrbxRfjpkdHuUX114tCPlOlD3Viy O7XBfgOdvboRqSTzMsg/QM+MxqHliz3BduzxJsE8+zpNhgciwVkJlbX1IJ5BYD2mjG9Z cx8IbbEu5b1otQIDwstUMYGtrUICC1umudJ1I36Gv66kD5MsgyQNt3KlioGFjTXatfdL NlOQ== MIME-Version: 1.0 X-Received: by 10.107.170.87 with SMTP id t84mr19548882ioe.2.1427840354166; Tue, 31 Mar 2015 15:19:14 -0700 (PDT) Received: by 10.36.78.80 with HTTP; Tue, 31 Mar 2015 15:19:14 -0700 (PDT) Date: Tue, 31 Mar 2015 15:19:14 -0700 Message-ID: Subject: ROW or RANGE not optional in range specification From: "David G. Johnston" To: "pgsql-docs@postgresql.org" Content-Type: multipart/alternative; boundary=001a11415cc81b30a605129cfd4c X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org --001a11415cc81b30a605129cfd4c Content-Type: text/plain; charset=UTF-8 http://www.postgresql.org/docs/devel/static/sql-select.html Either I'm confused about the syntax description rules or the documentation for this aspect of window definitions is wrong. The expression: [ RANGE | ROWS ] BETWEEN frame_start AND frame_end means that the specification of range or rows is optional - but that doesn't appear to be the case... The documentation should read: { RANGE | ROWS } BETWEEN frame_start AND frame_end Same goes for the bare frame_start specification preceding the between version. The bare version looks funny without tag but "ORDER BY idx BETWEEN 5 PRECEDING AND CURRENT ROW" isn't obviously wrong until you get a syntax error... David J. --001a11415cc81b30a605129cfd4c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Either I'm confused abo= ut the syntax description rules or the documentation for this aspect of win= dow definitions is wrong.

The expressi= on:

[ RANGE | ROWS ]=C2=A0=C2=A0BETWEE= N frame_start AND frame_end
=
means that= the specification of range or rows is optional - but that doesn't appe= ar to be the case...

The documentation= should read:

{ RANGE | ROWS } BETWEEN= frame_start AND frame_end
<= font face=3D"arial, helvetica, sans-serif">
Same goes f= or the bare frame_start specification preceding the between version.=

The bare version looks funny without tag but= "ORDER BY idx BETWEEN 5 PRECEDING AND CURRENT ROW" isn't obv= iously wrong until you get a syntax error...

David J.

--001a11415cc81b30a605129cfd4c-- From tgl@sss.pgh.pa.us Sun May 24 13:52:05 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yd5xI-0002fp-S7 for pgsql-docs@arkaria.postgresql.org; Tue, 31 Mar 2015 23:52:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yd5xI-0002Ch-Aj for pgsql-docs@arkaria.postgresql.org; Tue, 31 Mar 2015 23:52:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yd5xG-0002Ag-Ur for pgsql-docs@postgresql.org; Tue, 31 Mar 2015 23:52:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yd5xD-0000PA-QN for pgsql-docs@postgresql.org; Tue, 31 Mar 2015 23:52: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 t2VNqFnD014900; Tue, 31 Mar 2015 19:52:15 -0400 From: Tom Lane To: "David G. Johnston" cc: "pgsql-docs@postgresql.org" Subject: Re: ROW or RANGE not optional in range specification In-reply-to: References: Comments: In-reply-to "David G. Johnston" message dated "Tue, 31 Mar 2015 15:19:14 -0700" Date: Tue, 31 Mar 2015 19:52:15 -0400 Message-ID: <14899.1427845935@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org "David G. Johnston" writes: > Either I'm confused about the syntax description rules or the documentation > for this aspect of window definitions is wrong. > The expression: > [ RANGE | ROWS ] BETWEEN frame_start AND frame_end > means that the specification of range or rows is optional - but that > doesn't appear to be the case... > The documentation should read: > { RANGE | ROWS } BETWEEN frame_start AND frame_end Yup, you're right. Thanks for spotting that! regards, tom lane -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs