Skip site navigation (1) Skip section navigation (2)

Re: incorrect syntax for offset

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: incorrect syntax for offset
Date: 2010-02-23 22:47:48
Message-ID: 201002232247.o1NMlmi26595@momjian.us (view raw or flat)
Thread:
Lists: pgsql-docs
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  <bruce(at)momjian(dot)us>        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. +

In response to

pgsql-docs by date

Next:From: Bruce MomjianDate: 2010-02-24 03:33:49
Subject: Re: Removal of pre-7.4 documentation items
Previous:From: Bruce MomjianDate: 2010-02-23 00:21:25
Subject: Re: pg_restore listing

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group