summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2020-12-15 19:20:15 -0500
committerBruce Momjian <bruce@momjian.us>2020-12-15 19:20:15 -0500
commitde7b034dafd3847cddcd5f96cca1efce6f7ace8a (patch)
tree0ed8a29c13374149a8a655943ccfe973684a698c
parentfde5f130c9c30e75c7a8ee33095a6a7e79d5b626 (diff)
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
-rw-r--r--doc/src/sgml/ref/copy.sgml24
1 files changed, 10 insertions, 14 deletions
diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml
index 18189abc6c9..5ae915ee9ed 100644
--- a/doc/src/sgml/ref/copy.sgml
+++ b/doc/src/sgml/ref/copy.sgml
@@ -411,10 +411,16 @@ COPY <replaceable class="parameter">count</replaceable>
<title>Notes</title>
<para>
- <command>COPY TO</command> can only be used with plain tables, not
- with views. However, you can write <literal>COPY (SELECT * FROM
- <replaceable class="parameter">viewname</replaceable>) TO ...</literal>
- to copy the current contents of a view.
+ <command>COPY TO</command> can be used only with plain
+ tables, not views, and does not copy rows from child tables
+ or child partitions. For example, <literal>COPY <replaceable
+ 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>
@@ -424,16 +430,6 @@ COPY <replaceable class="parameter">count</replaceable>
</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>
You must have select privilege on the table
whose values are read by <command>COPY TO</command>, and
insert privilege on the table into which values