pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Smith <greg@2ndQuadrant.com>
To: pgsql-docs <pgsql-docs@postgresql.org>
Subject: VALUES lists aliases
Date: Tue, 21 May 2013 12:18:09 -0400
Message-ID: <519B9E41.4080509@2ndQuadrant.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-docs>

Next from the stream of doc comments, someone points out that if you 
read http://www.postgresql.org/docs/current/static/queries-values.html a 
beginner may not understand just what " table alias list" means.  If you 
start at the beginning of the chapter it makes more sense, but it isn't 
necessarily obvious even then.

Easiest fix is to demonstrate this by example, so that's what the 
attached patch adds.  There was an example of this approach in the full 
documentation of VALUES already, but I felt that one was too complicated 
for a tutorial section.

-- 
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.com

-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

Attachments:

alias-list-example.patch (text/plain, 660B) download diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml index d7b0d73..cf477c7 100644 --- a/doc/src/sgml/queries.sgml +++ b/doc/src/sgml/queries.sgml @@ -1609,7 +1609,16 @@ SELECT 3, 'three'; <literal>VALUES</> table. The column names are not specified by the SQL standard and different database systems do it differently, so it's usually better to override the default names with a table alias - list. + list: +<programlisting> +=> SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (3, 'three')) AS t (num,letter); + num | letter +-----+-------- + 1 | one + 2 | two + 3 | three +(3 rows) +</programlisting> </para> <para>

view thread (2+ messages)  latest in thread

Message-ID: <519B9E41.4080509@2ndQuadrant.com>
Permalink:  ../519B9E41.4080509@2ndQuadrant.com/
Also on:    postgresql.org/message-id/519B9E41.4080509@2ndQuadrant.com

 ·  · 

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: pgsql-docs@postgresql.org
  Cc: greg@2ndQuadrant.com
  Subject: Re: VALUES lists aliases
  In-Reply-To: <519B9E41.4080509@2ndQuadrant.com>

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

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