What is the SQL Standard method of doing LIMIT OFFSET? I know LIMIT and OFFSET are pretty common but unstandardized methods to page through a result set. I know there is a standardized method, but I can never find this when I'm going to look it up,


The PostgreSQL LIMIT/OFFSET docs don't link to it,
The PostgreSQL FETCH docs don't link to it either.


I know it's not either of them. What is the SQL Standard and PostgreSQL syntax for LIMIT and OFFSET?
SQL 2011 Spec

The syntax in the spec is defined as,

&lt;query expression&gt; ::=
  [ &lt;with clause&gt; ] &lt;query expression body&gt;
  [ &lt;order by clause&gt; ] [ &lt;result offset clause&gt; ] [ &lt;fetch first clause&gt; ]


You can see here that &lt;result offset clause&gt; and the &lt;fetch first clause&gt; are both optional and stand by themselves, moving on

&lt;result offset clause&gt; ::=
  OFFSET &lt;offset row count&gt; { ROW | ROWS }

&lt;fetch first clause&gt; ::=
  FETCH { FIRST | NEXT } [ &lt;fetch first quantity&gt; ] { ROW | ROWS } { ONLY | WITH TIES }

&lt;fetch first quantity&gt; ::=
  &lt;fetch first row count&gt;
  | &lt;fetch first percentage&gt;

&lt;offset row count&gt; ::=
  &lt;simple value specification&gt;

&lt;fetch first row count&gt; ::=
  &lt;simple value specification&gt;

&lt;fetch first percentage&gt; ::=
  &lt;simple value specification&gt; PERCENT

&lt;simple value specification&gt; ::=
  &lt;literal&gt;
  | &lt;host parameter name&gt;
  | &lt;SQL parameter reference&gt;
  | &lt;embedded variable name&gt;


RDBMS-Specific

PostgreSQL

The SQL:2011 Spec supports a bit more than PostgreSQL, namely a WITH TIES option (F867) and the ability to specify PERCENT option (F866). The query is defined as,

PostgreSQL only documents this, AFAIK, in SELECT,

SELECT
...
[ OFFSET start [ ROW | ROWS ] ]
[ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]


For more information aside from PostgreSQL, and the spec see the tag-info for offset-fetch