diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index e603b76..a68014b 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -33,13 +33,14 @@ PostgreSQL documentation [ WITH [ RECURSIVE ] with_query [, ...] ] -SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] +{ SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] * | expression [ [ AS ] output_name ] [, ...] [ FROM from_item [, ...] ] [ WHERE condition ] [ GROUP BY expression [, ...] ] [ HAVING condition [, ...] ] [ WINDOW window_name AS ( window_definition ) [, ...] ] +| TABLE [ ONLY ] table_name [ * ] } [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ] [ ORDER BY expression [ ASC | DESC | USING operator ] [ NULLS { FIRST | LAST } ] [, ...] ] [ LIMIT { count | ALL } ] @@ -60,8 +61,6 @@ SELECT [ ALL | DISTINCT [ ON ( expressionand with_query is: with_query_name [ ( column_name [, ...] ) ] AS ( select | values | insert | update | delete ) - -TABLE [ ONLY ] table_name [ * ] @@ -198,6 +197,27 @@ TABLE [ ONLY ] table_name [ * ] UPDATE privilege as well (for at least one column of each table so selected). + + + <literal>TABLE</literal> Command + + + The command + +TABLE name + + is equivalent to + +SELECT * FROM name + + It can be used as a top-level command or as a space-saving syntax + variant in parts of complex queries. Only the WITH, ORDER BY, LIMIT, + and Locking clauses and set operations can be used with TABLE; the + WHERE clause and any form of aggregation cannot be used. + + Note that on this page and other places in the documentation, where SELECT is mentioned, TABLE is also assumed, subject to the restrictions mentioned here. + + @@ -211,7 +231,7 @@ TABLE [ ONLY ] table_name [ * ] subqueries that can be referenced by name in the primary query. The subqueries effectively act as temporary tables or views for the duration of the primary query. - Each subquery can be a SELECT, VALUES, + Each subquery can be a SELECT, TABLE, VALUES, INSERT, UPDATE or DELETE statement. When writing a data-modifying statement (INSERT, @@ -1437,23 +1457,6 @@ SELECT * FROM (SELECT * FROM mytable FOR UPDATE) ss ORDER BY column1; - - - <literal>TABLE</literal> Command - - - The command - -TABLE name - - is completely equivalent to - -SELECT * FROM name - - It can be used as a top-level command or as a space-saving syntax - variant in parts of complex queries. - -