2018-03-15 7:18 GMT-03:00 PG Doc comments form <nore...@postgresql.org>: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/10/static/sql-select.html > Description: > > The SYNOPSIS section of the "SELECT" SQL command contains the line > > [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ] > > (with a boldface "select"), but it is not clear what is meant by that > "select". Further down the page, in the "UNION clause" section (and also > INTERSECTION or EXCEPT), it is written: > "select" is defined as a sub-select that can appear in the FROM clause (see the From Clause section).
> select_statement UNION [ ALL | DISTINCT ] select_statement > > which uses boldface "select_statement" instead of boldface "select" as in > the synopsis. This is confusing. > It is a bug in the synopsis. UNION et al cannot contain some elements (such as ORDER BY) that is allowed for a sub-select. The attached patch replace "select" with the correct element ("select_statement"). -- Euler Taveira Timbira - http://www.timbira.com.br/ PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index b5d3d3a..5acd749 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -40,7 +40,7 @@ SELECT [ ALL | DISTINCT [ ON ( <replaceable class="parameter">expression</replac [ GROUP BY <replaceable class="parameter">grouping_element</replaceable> [, ...] ] [ HAVING <replaceable class="parameter">condition</replaceable> [, ...] ] [ WINDOW <replaceable class="parameter">window_name</replaceable> AS ( <replaceable class="parameter">window_definition</replaceable> ) [, ...] ] - [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] <replaceable class="parameter">select</replaceable> ] + [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] <replaceable class="parameter">select_statement</replaceable> ] [ ORDER BY <replaceable class="parameter">expression</replaceable> [ ASC | DESC | USING <replaceable class="parameter">operator</replaceable> ] [ NULLS { FIRST | LAST } ] [, ...] ] [ LIMIT { <replaceable class="parameter">count</replaceable> | ALL } ] [ OFFSET <replaceable class="parameter">start</replaceable> [ ROW | ROWS ] ]