mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
TABLE command
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table_as.sgml,v 1.39 2008/11/14 10:22:46 petere Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table_as.sgml,v 1.40 2008/11/20 14:04:45 petere Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -196,10 +196,12 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name
|
||||
<term><replaceable>query</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A <xref linkend="sql-select" endterm="sql-select-title"> or
|
||||
A <xref linkend="sql-select"
|
||||
endterm="sql-select-title">, <link linkend="sql-table">TABLE</link>,
|
||||
or
|
||||
<xref linkend="sql-values" endterm="sql-values-title"> command,
|
||||
or an <xref linkend="sql-execute" endterm="sql-execute-title"> command
|
||||
that runs a prepared <command>SELECT</> or <command>VALUES</> query.
|
||||
that runs a prepared <command>SELECT</>, <command>TABLE</>, or <command>VALUES</> query.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -260,6 +262,16 @@ CREATE TABLE films_recent AS
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To copy a table completely, the short form using
|
||||
the <literal>TABLE</literal> command can also be used:
|
||||
|
||||
<programlisting>
|
||||
CREATE TABLE films2 AS
|
||||
TABLE films;
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Create a new temporary table <literal>films_recent</literal>, consisting of
|
||||
only recent entries from the table <literal>films</literal>, using a
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/select.sgml,v 1.109 2008/11/19 12:21:57 petere Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/select.sgml,v 1.110 2008/11/20 14:04:45 petere Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -12,6 +12,7 @@ PostgreSQL documentation
|
||||
|
||||
<refnamediv>
|
||||
<refname>SELECT</refname>
|
||||
<refname>TABLE</refname>
|
||||
<refname>WITH</refname>
|
||||
<refpurpose>retrieve rows from a table or view</refpurpose>
|
||||
</refnamediv>
|
||||
@ -20,6 +21,10 @@ PostgreSQL documentation
|
||||
<primary>SELECT</primary>
|
||||
</indexterm>
|
||||
|
||||
<indexterm zone="sql-select">
|
||||
<primary>TABLE command</primary>
|
||||
</indexterm>
|
||||
|
||||
<indexterm zone="sql-select">
|
||||
<primary>WITH</primary>
|
||||
<secondary>in SELECT</secondary>
|
||||
@ -53,6 +58,8 @@ where <replaceable class="parameter">from_item</replaceable> can be one of:
|
||||
and <replaceable class="parameter">with_query</replaceable> is:
|
||||
|
||||
<replaceable class="parameter">with_query_name</replaceable> [ ( <replaceable class="parameter">column_name</replaceable> [, ...] ) ] AS ( <replaceable class="parameter">select</replaceable> )
|
||||
|
||||
TABLE <replaceable class="parameter">table_name</replaceable> | <replaceable class="parameter">with_query_name</replaceable>
|
||||
</synopsis>
|
||||
|
||||
</refsynopsisdiv>
|
||||
@ -1071,6 +1078,23 @@ ROLLBACK TO s;
|
||||
</para>
|
||||
</caution>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="SQL-TABLE">
|
||||
<title><literal>TABLE</literal> Command</title>
|
||||
|
||||
<para>
|
||||
The command
|
||||
<programlisting>
|
||||
TABLE <replaceable class="parameter">name</replaceable>
|
||||
</programlisting>
|
||||
is completely equivalent to
|
||||
<programlisting>
|
||||
SELECT * FROM <replaceable class="parameter">name</replaceable>
|
||||
</programlisting>
|
||||
It can be used as a top-level command or as a space-saving syntax
|
||||
variant in parts of complex queries.
|
||||
</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
|
Reference in New Issue
Block a user