aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2013-12-10 09:34:37 -0500
committerNoah Misch <noah@leadboat.com>2013-12-10 09:34:37 -0500
commit53685d79813a46c7e3a46ae4b1210f608d41d6ab (patch)
tree8760f628f2d5baf874307624248f92e80475d9ca /doc/src
parent01cc1fecfdecc37649b3996100ab1f03ccc8ab7e (diff)
downloadpostgresql-53685d79813a46c7e3a46ae4b1210f608d41d6ab.tar.gz
postgresql-53685d79813a46c7e3a46ae4b1210f608d41d6ab.zip
Rename TABLE() to ROWS FROM().
SQL-standard TABLE() is a subset of UNNEST(); they deal with arrays and other collection types. This feature, however, deals with set-returning functions. Use a different syntax for this feature to keep open the possibility of implementing the standard TABLE().
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/queries.sgml16
-rw-r--r--doc/src/sgml/ref/select.sgml19
2 files changed, 17 insertions, 18 deletions
diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml
index b33de682005..daba74bd631 100644
--- a/doc/src/sgml/queries.sgml
+++ b/doc/src/sgml/queries.sgml
@@ -647,7 +647,7 @@ FROM (VALUES ('anne', 'smith'), ('bob', 'jones'), ('joe', 'blow'))
</para>
<para>
- Table functions may also be combined using the <literal>TABLE</literal>
+ Table functions may also be combined using the <literal>ROWS FROM</>
syntax, with the results returned in parallel columns; the number of
result rows in this case is that of the largest function result, with
smaller results padded with NULLs to match.
@@ -655,7 +655,7 @@ FROM (VALUES ('anne', 'smith'), ('bob', 'jones'), ('joe', 'blow'))
<synopsis>
<replaceable>function_call</replaceable> <optional>WITH ORDINALITY</optional> <optional><optional>AS</optional> <replaceable>table_alias</replaceable> <optional>(<replaceable>column_alias</replaceable> <optional>, ... </optional>)</optional></optional>
-TABLE( <replaceable>function_call</replaceable> <optional>, ... </optional> ) <optional>WITH ORDINALITY</optional> <optional><optional>AS</optional> <replaceable>table_alias</replaceable> <optional>(<replaceable>column_alias</replaceable> <optional>, ... </optional>)</optional></optional>
+ROWS FROM( <replaceable>function_call</replaceable> <optional>, ... </optional> ) <optional>WITH ORDINALITY</optional> <optional><optional>AS</optional> <replaceable>table_alias</replaceable> <optional>(<replaceable>column_alias</replaceable> <optional>, ... </optional>)</optional></optional>
</synopsis>
<para>
@@ -674,7 +674,7 @@ TABLE( <replaceable>function_call</replaceable> <optional>, ... </optional> ) <o
any number of array parameters, and it returns a corresponding number of
columns, as if <literal>UNNEST</literal>
(<xref linkend="functions-array">) had been called on each parameter
- separately and combined using the <literal>TABLE</literal> construct.
+ separately and combined using the <literal>ROWS FROM</literal> construct.
</para>
<synopsis>
@@ -683,7 +683,7 @@ UNNEST( <replaceable>array_expression</replaceable> <optional>, ... </optional>
<para>
If no <replaceable>table_alias</replaceable> is specified, the function
- name is used as the table name; in the case of a <literal>TABLE()</>
+ name is used as the table name; in the case of a <literal>ROWS FROM()</>
construct, the first function's name is used.
</para>
@@ -731,20 +731,20 @@ SELECT * FROM vw_getfoo;
<synopsis>
<replaceable>function_call</replaceable> <optional>AS</optional> <replaceable>alias</replaceable> (<replaceable>column_definition</replaceable> <optional>, ... </optional>)
<replaceable>function_call</replaceable> AS <optional><replaceable>alias</replaceable></optional> (<replaceable>column_definition</replaceable> <optional>, ... </optional>)
-TABLE( ... <replaceable>function_call</replaceable> AS (<replaceable>column_definition</replaceable> <optional>, ... </optional>) <optional>, ... </optional> )
+ROWS FROM( ... <replaceable>function_call</replaceable> AS (<replaceable>column_definition</replaceable> <optional>, ... </optional>) <optional>, ... </optional> )
</synopsis>
<para>
- When not using the <literal>TABLE()</> syntax,
+ When not using the <literal>ROWS FROM()</> syntax,
the <replaceable>column_definition</replaceable> list replaces the column
alias list that could otherwise be attached to the <literal>FROM</>
item; the names in the column definitions serve as column aliases.
- When using the <literal>TABLE()</> syntax,
+ When using the <literal>ROWS FROM()</> syntax,
a <replaceable>column_definition</replaceable> list can be attached to
each member function separately; or if there is only one member function
and no <literal>WITH ORDINALITY</> clause,
a <replaceable>column_definition</replaceable> list can be written in
- place of a column alias list following <literal>TABLE()</>.
+ place of a column alias list following <literal>ROWS FROM()</>.
</para>
<para>
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml
index 88ebd73d49c..d6a17cc7a44 100644
--- a/doc/src/sgml/ref/select.sgml
+++ b/doc/src/sgml/ref/select.sgml
@@ -56,7 +56,7 @@ SELECT [ ALL | DISTINCT [ ON ( <replaceable class="parameter">expression</replac
[ WITH ORDINALITY ] [ [ AS ] <replaceable class="parameter">alias</replaceable> [ ( <replaceable class="parameter">column_alias</replaceable> [, ...] ) ] ]
[ LATERAL ] <replaceable class="parameter">function_name</replaceable> ( [ <replaceable class="parameter">argument</replaceable> [, ...] ] ) [ AS ] <replaceable class="parameter">alias</replaceable> ( <replaceable class="parameter">column_definition</replaceable> [, ...] )
[ LATERAL ] <replaceable class="parameter">function_name</replaceable> ( [ <replaceable class="parameter">argument</replaceable> [, ...] ] ) AS ( <replaceable class="parameter">column_definition</replaceable> [, ...] )
- [ LATERAL ] TABLE( <replaceable class="parameter">function_name</replaceable> ( [ <replaceable class="parameter">argument</replaceable> [, ...] ] ) [ AS ( <replaceable class="parameter">column_definition</replaceable> [, ...] ) ] [, ...] )
+ [ LATERAL ] ROWS FROM( <replaceable class="parameter">function_name</replaceable> ( [ <replaceable class="parameter">argument</replaceable> [, ...] ] ) [ AS ( <replaceable class="parameter">column_definition</replaceable> [, ...] ) ] [, ...] )
[ WITH ORDINALITY ] [ [ AS ] <replaceable class="parameter">alias</replaceable> [ ( <replaceable class="parameter">column_alias</replaceable> [, ...] ) ] ]
<replaceable class="parameter">from_item</replaceable> [ NATURAL ] <replaceable class="parameter">join_type</replaceable> <replaceable class="parameter">from_item</replaceable> [ ON <replaceable class="parameter">join_condition</replaceable> | USING ( <replaceable class="parameter">join_column</replaceable> [, ...] ) ]
@@ -390,7 +390,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
<para>
Multiple function calls can be combined into a
single <literal>FROM</>-clause item by surrounding them
- with <literal>TABLE( ... )</>. The output of such an item is the
+ with <literal>ROWS FROM( ... )</>. The output of such an item is the
concatenation of the first row from each function, then the second
row from each function, etc. If some of the functions produce fewer
rows than others, NULLs are substituted for the missing data, so
@@ -410,18 +410,18 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
</para>
<para>
- When using the <literal>TABLE( ... )</> syntax, if one of the
+ When using the <literal>ROWS FROM( ... )</> syntax, if one of the
functions requires a column definition list, it's preferred to put
the column definition list after the function call inside
- <literal>TABLE( ... )</>. A column definition list can be placed
- after the <literal>TABLE( ... )</> construct only if there's just a
- single function and no <literal>WITH ORDINALITY</> clause.
+ <literal>ROWS FROM( ... )</>. A column definition list can be placed
+ after the <literal>ROWS FROM( ... )</> construct only if there's just
+ a single function and no <literal>WITH ORDINALITY</> clause.
</para>
<para>
To use <literal>ORDINALITY</literal> together with a column definition
- list, you must use the <literal>TABLE( ... )</> syntax and put the
- column definition list inside <literal>TABLE( ... )</>.
+ list, you must use the <literal>ROWS FROM( ... )</> syntax and put the
+ column definition list inside <literal>ROWS FROM( ... )</>.
</para>
</listitem>
</varlistentry>
@@ -1811,8 +1811,7 @@ SELECT distributors.* WHERE distributors.name = 'Westward';
</para>
<para>
- Placing multiple function calls inside <literal>TABLE( ... )</> syntax is
- also an extension of the SQL standard.
+ <literal>ROWS FROM( ... )</> is an extension of the SQL standard.
</para>
</refsect2>