[DOCS] recommending change to first example in 7.8.1 - Mailing list pgsql-docs

From ruth@dannerdata.com
Subject [DOCS] recommending change to first example in 7.8.1
Date
Msg-id 20170724215040.1455.75538@wrigleys.postgresql.org
Whole thread Raw
Responses Re: [DOCS] recommending change to first example in 7.8.1  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-docs
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.6/static/queries-with.html
Description:

The first example in 7.8.1 shown below includes a field called 'quantity' to
be summed in the primary SELECT statement. I think this is a mistake. I do
not think this field exists in the WITH virtual table.

7.8.1. SELECT in WITH

The basic value of SELECT in WITH is to break down complicated queries into
simpler parts. An example is:
WITH regional_sales AS (
        SELECT region, SUM(amount) AS total_sales
        FROM orders
        GROUP BY region
     ), top_regions AS (
        SELECT region
        FROM regional_sales
        WHERE total_sales > (SELECT SUM(total_sales)/10 FROM
regional_sales)
     )
SELECT region,
       product,
       SUM(quantity) AS product_units,
       SUM(amount) AS product_sales
FROM orders
WHERE region IN (SELECT region FROM top_regions)
GROUP BY region, product;


pgsql-docs by date:

Previous
From: gorka.gil@openbravo.com
Date:
Subject: [DOCS] remove shmmax example in Linux section
Next
From: Daniel Westermann
Date:
Subject: [DOCS] DEFERRABLE/NOT DEFERRABLE, what is a command?