Re: SQL:2008 LIMIT/OFFSET - Mailing list pgsql-hackers

From Tom Lane
Subject Re: SQL:2008 LIMIT/OFFSET
Date
Msg-id 27312.1224506767@sss.pgh.pa.us
Whole thread Raw
In response to SQL:2008 LIMIT/OFFSET  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: SQL:2008 LIMIT/OFFSET
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> SQL:2008 specifies the following syntax for what we have so far called 
> LIMIT and OFFSET
> SELECT ... [ ORDER BY ... ]
>      OFFSET num {ROW|ROWS} FETCH {FIRST|NEXT} [num] {ROW|ROWS} ONLY

What does the "NEXT" option mean?  I'm a bit worried that this isn't
actually quite equivalent to LIMIT.

> If we want to avoid reshuffling the expression syntax (always good to 
> avoid) and avoid making ROWS reserved, we need to make some arbitrary 
> restrictions on what kinds of expressions can be used in these clauses. 

This syntax seems sufficiently brain-dead that only standards-compliance
fanatics would use it.  Accordingly, limiting it to match the letter
of the standard (literals only) is probably sufficient.

BTW, I think it's a bad idea to assign made-up parse locations, as
you did here:

> +            | /*EMPTY*/        { $$ = makeIntConst(1, @$); }

Just use -1.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: contrib/pg_stat_statements
Next
From: Magnus Hagander
Date:
Subject: SSL cleanups/hostname verification