mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-23 13:20:40 +02:00
doc: clarify COPY TO for partitioning/inheritance
It was not clear how COPY TO behaved with partitioning/inheritance because the paragraphs were so far apart. Also reword to simplify. Discussion: https://postgr.es/m/20201203211723.GR24052@telsasoft.com Author: Justin Pryzby Backpatch-through: 10
This commit is contained in:
parent
355f9d2452
commit
48cbed8821
@ -396,10 +396,16 @@ COPY <replaceable class="parameter">count</replaceable>
|
|||||||
<title>Notes</title>
|
<title>Notes</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<command>COPY TO</command> can only be used with plain tables, not
|
<command>COPY TO</command> can be used only with plain
|
||||||
with views. However, you can write <literal>COPY (SELECT * FROM
|
tables, not views, and does not copy rows from child tables
|
||||||
<replaceable class="parameter">viewname</replaceable>) TO ...</literal>
|
or child partitions. For example, <literal>COPY <replaceable
|
||||||
to copy the current contents of a view.
|
class="parameter">table</replaceable> TO</literal> copies
|
||||||
|
the same rows as <literal>SELECT * FROM ONLY <replaceable
|
||||||
|
class="parameter">table</replaceable></literal>.
|
||||||
|
The syntax <literal>COPY (SELECT * FROM <replaceable
|
||||||
|
class="parameter">table</replaceable>) TO ...</literal> can be used to
|
||||||
|
dump all of the rows in an inheritance hierarchy, partitioned table,
|
||||||
|
or view.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -408,16 +414,6 @@ COPY <replaceable class="parameter">count</replaceable>
|
|||||||
<literal>INSTEAD OF INSERT</literal> triggers.
|
<literal>INSTEAD OF INSERT</literal> triggers.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
|
||||||
<command>COPY</command> only deals with the specific table named;
|
|
||||||
it does not copy data to or from child tables. Thus for example
|
|
||||||
<literal>COPY <replaceable class="parameter">table</replaceable> TO</literal>
|
|
||||||
shows the same data as <literal>SELECT * FROM ONLY <replaceable
|
|
||||||
class="parameter">table</replaceable></literal>. But <literal>COPY
|
|
||||||
(SELECT * FROM <replaceable class="parameter">table</replaceable>) TO ...</literal>
|
|
||||||
can be used to dump all of the data in an inheritance hierarchy.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
You must have select privilege on the table
|
You must have select privilege on the table
|
||||||
whose values are read by <command>COPY TO</command>, and
|
whose values are read by <command>COPY TO</command>, and
|
||||||
|
Loading…
Reference in New Issue
Block a user