public inbox for [email protected]  
help / color / mirror / Atom feed
incorrect syntax for offset
3+ messages / 3 participants
[nested] [flat]

* incorrect syntax for offset
@ 2009-08-18 22:08 Jaime Casanova <[email protected]>
  2009-08-18 22:56 ` Re: incorrect syntax for offset Tom Lane <[email protected]>
  2010-02-23 22:47 ` Re: incorrect syntax for offset Bruce Momjian <[email protected]>
  0 siblings, 2 replies; 3+ messages in thread

From: Jaime Casanova @ 2009-08-18 22:08 UTC (permalink / raw)
  To: pgsql-docs

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;
                                    ^
-- 
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: incorrect syntax for offset
  2009-08-18 22:08 incorrect syntax for offset Jaime Casanova <[email protected]>
@ 2009-08-18 22:56 ` Tom Lane <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2009-08-18 22:56 UTC (permalink / raw)
  To: Jaime Casanova <[email protected]>; +Cc: pgsql-docs

Jaime Casanova <[email protected]> writes:
> 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;

Hmm.  Seems like we could refactor the select_limit production so it
actually allows all the reasonable combinations.  Let me have a look...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: incorrect syntax for offset
  2009-08-18 22:08 incorrect syntax for offset Jaime Casanova <[email protected]>
@ 2010-02-23 22:47 ` Bruce Momjian <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2010-02-23 22:47 UTC (permalink / raw)
  To: Jaime Casanova <[email protected]>; +Cc: 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  <[email protected]>        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. +




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2010-02-23 22:47 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-08-18 22:08 incorrect syntax for offset Jaime Casanova <[email protected]>
2009-08-18 22:56 ` Tom Lane <[email protected]>
2010-02-23 22:47 ` Bruce Momjian <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox