public inbox for [email protected]  
help / color / mirror / Atom feed
From: Euler Taveira <[email protected]>
To: [email protected]
To: [email protected]
Subject: Re: Synopsis of SELECT statement: UNION, INTERSECTION, EXCEPT
Date: Fri, 16 Mar 2018 01:02:13 -0300
Message-ID: <CAHE3wgiaV1YyQ6-v12R4bzmQoUc_5E3hBupKxHTzLXg2TOsh-g@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

2018-03-15 7:18 GMT-03:00 PG Doc comments form <[email protected]>:
> 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


Attachments:

  [text/x-patch] doc.diff (1.1K, 2-doc.diff)
  download | inline diff:
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 ] ]


view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Synopsis of SELECT statement: UNION, INTERSECTION, EXCEPT
  In-Reply-To: <CAHE3wgiaV1YyQ6-v12R4bzmQoUc_5E3hBupKxHTzLXg2TOsh-g@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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