@@ -588,8 +588,6 @@ SELECT * FROM my_table AS m WHERE my_table.a > 5; -- wrong
588588<programlisting>
589589SELECT * FROM people AS mother JOIN people AS child ON mother.id = child.mother_id;
590590</programlisting>
591- Additionally, an alias is required if the table reference is a
592- subquery (see <xref linkend="queries-subqueries"/>).
593591 </para>
594592
595593 <para>
@@ -639,9 +637,9 @@ SELECT a.* FROM (my_table AS a JOIN your_table AS b ON ...) AS c
639637
640638 <para>
641639 Subqueries specifying a derived table must be enclosed in
642- parentheses and <emphasis>must</emphasis> be assigned a table
643- alias name (as in <xref linkend="queries-table-aliases"/>). For
644- example:
640+ parentheses. They may be assigned a table alias name, and optionally
641+ column alias names (as in <xref linkend="queries-table-aliases"/>).
642+ For example:
645643<programlisting>
646644FROM (SELECT * FROM table1) AS alias_name
647645</programlisting>
@@ -660,10 +658,18 @@ FROM (SELECT * FROM table1) AS alias_name
660658FROM (VALUES ('anne', 'smith'), ('bob', 'jones'), ('joe', 'blow'))
661659 AS names(first, last)
662660</programlisting>
663- Again, a table alias is required . Assigning alias names to the columns
661+ Again, a table alias is optional . Assigning alias names to the columns
664662 of the <command>VALUES</command> list is optional, but is good practice.
665663 For more information see <xref linkend="queries-values"/>.
666664 </para>
665+
666+ <para>
667+ According to the SQL standard, a table alias name must be supplied
668+ for a subquery. <productname>PostgreSQL</productname>
669+ allows <literal>AS</literal> and the alias to be omitted, but
670+ writing one is good practice in SQL code that might be ported to
671+ another system.
672+ </para>
667673 </sect3>
668674
669675 <sect3 id="queries-tablefunctions">
0 commit comments