diff options
| author | Dean Rasheed <dean.a.rasheed@gmail.com> | 2022-07-20 09:29:42 +0100 |
|---|---|---|
| committer | Dean Rasheed <dean.a.rasheed@gmail.com> | 2022-07-20 09:29:42 +0100 |
| commit | bcedd8f5fce0b69970cf0cee7bca560833d05869 (patch) | |
| tree | c37888d24735977b7a0463b0277c1cbe459ac69f /doc/src | |
| parent | 1caf915ff31e91031f0a0b8e1016df2b59d6f9de (diff) | |
Make subquery aliases optional in the FROM clause.
This allows aliases for sub-SELECTs and VALUES clauses in the FROM
clause to be omitted.
This is an extension of the SQL standard, supported by some other
database systems, and so eases the transition from such systems, as
well as removing the minor inconvenience caused by requiring these
aliases.
Patch by me, reviewed by Tom Lane.
Discussion: https://postgr.es/m/CAEZATCUCGCf82=hxd9N5n6xGHPyYpQnxW8HneeH+uP7yNALkWA@mail.gmail.com
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/sgml/ref/select.sgml | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index 80bb8adcacc..410c80e730b 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -51,7 +51,7 @@ SELECT [ ALL | DISTINCT [ ON ( <replaceable class="parameter">expression</replac [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [ [ AS ] <replaceable class="parameter">alias</replaceable> [ ( <replaceable class="parameter">column_alias</replaceable> [, ...] ) ] ] [ TABLESAMPLE <replaceable class="parameter">sampling_method</replaceable> ( <replaceable class="parameter">argument</replaceable> [, ...] ) [ REPEATABLE ( <replaceable class="parameter">seed</replaceable> ) ] ] - [ LATERAL ] ( <replaceable class="parameter">select</replaceable> ) [ AS ] <replaceable class="parameter">alias</replaceable> [ ( <replaceable class="parameter">column_alias</replaceable> [, ...] ) ] + [ LATERAL ] ( <replaceable class="parameter">select</replaceable> ) [ [ AS ] <replaceable class="parameter">alias</replaceable> [ ( <replaceable class="parameter">column_alias</replaceable> [, ...] ) ] ] <replaceable class="parameter">with_query_name</replaceable> [ [ AS ] <replaceable class="parameter">alias</replaceable> [ ( <replaceable class="parameter">column_alias</replaceable> [, ...] ) ] ] [ LATERAL ] <replaceable class="parameter">function_name</replaceable> ( [ <replaceable class="parameter">argument</replaceable> [, ...] ] ) [ WITH ORDINALITY ] [ [ AS ] <replaceable class="parameter">alias</replaceable> [ ( <replaceable class="parameter">column_alias</replaceable> [, ...] ) ] ] @@ -490,8 +490,8 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] output were created as a temporary table for the duration of this single <command>SELECT</command> command. Note that the sub-<command>SELECT</command> must be surrounded by - parentheses, and an alias <emphasis>must</emphasis> be - provided for it. A + parentheses, and an alias can be provided in the same way as for a + table. A <link linkend="sql-values"><command>VALUES</command></link> command can also be used here. </para> @@ -2042,6 +2042,16 @@ SELECT 2+2; </refsect2> <refsect2> + <title>Omitting sub-<command>SELECT</command> aliases in <literal>FROM</literal></title> + + <para> + According to the SQL standard, a sub-<command>SELECT</command> in the + <literal>FROM</literal> list must have an alias. In + <productname>PostgreSQL</productname>, this alias may be omitted. + </para> + </refsect2> + + <refsect2> <title><literal>ONLY</literal> and Inheritance</title> <para> |
