>>>>> "Alvaro" == Alvaro Herrera <[EMAIL PROTECTED]> writes:
Alvaro> Wow, this is really horrid:
Alvaro> # F856 through F859: FETCH FIRST clause in subqueries,
Alvaro> views, and query expressions. The SQL:2008 syntax for
Alvaro> restricting the rows of a result set is FETCH FIRST, rather
Alvaro> than Microsoft SQL Server’s SELECT TOP N equivalent which
Alvaro> SQL Anywhere supports presently.
Alvaro> This means we have to support stuff like
Alvaro> declare foo cursor for select * from lists;
Alvaro> select * from (fetch first from foo) as bar;
No, that's wrong.
The new syntax is:
<query expression> ::=
[ <with clause> ] <query expression body>
[ <order by clause> ] [ <result offset clause> ] [ <fetch first clause> ]
<result offset clause> ::=
OFFSET <offset row count> { ROW | ROWS }
<fetch first clause> ::=
FETCH { FIRST | NEXT } [ <fetch first row count> ] { ROW | ROWS } ONLY
so it's like this:
select * from foo order by bar offset 5 rows fetch first 10 rows only;
(nothing that I can see assigns any semantics to FIRST vs NEXT, they seem
to do the same thing)
--
Andrew (irc:RhodiumToad)
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers