Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id B0989633EFC for ; Tue, 23 Feb 2010 18:47:58 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 56580-02 for ; Tue, 23 Feb 2010 22:47:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id D84D0633D21 for ; Tue, 23 Feb 2010 18:47:47 -0400 (AST) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id o1NMlmi26595; Tue, 23 Feb 2010 17:47:48 -0500 (EST) From: Bruce Momjian Message-Id: <201002232247.o1NMlmi26595@momjian.us> Subject: Re: incorrect syntax for offset In-Reply-To: <3073cc9b0908181508n766464b7jffab0fa3977299e5@mail.gmail.com> To: Jaime Casanova Date: Tue, 23 Feb 2010 17:47:48 -0500 (EST) CC: pgsql-docs X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.374 tagged_above=-10 required=5 tests=AWL=0.225, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/19 X-Sequence-Number: 5335 Jaime Casanova wrote: > Hi. > > Our current docs says that we support the following syntax (i'm > putting just the lines that disturbes me) inside a SELECT statement > """ > [ LIMIT { count | ALL } ] > [ OFFSET start [ ROW | ROWS ] ] > [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ] > """ > > i read that as allow me to use the ROWS in an OFFSET clause whatever i > use LIMIT or FETCH for limiting results but seems like we try hard to > make a distinguish from old syntax and new (sql standard) syntax > > pruebas=# select * from tab1 limit 3 offset 2 rows; > ERROR: syntax error at or near "rows" > LINE 1: select * from tab1 limit 3 offset 2 rows; > ^ > pruebas=# select * from tab1 offset 2 fetch next 3 rows only; > ERROR: syntax error at or near "fetch" > LINE 1: select * from tab1 offset 2 fetch next 3 rows only; FYI, this is fixed in 9.0: test=> select * from tab1 limit 3 offset 2 rows; x --- (0 rows) -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com PG East: http://www.enterprisedb.com/community/nav-pg-east-2010.do + If your life is a hard drive, Christ can be your backup. +