Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit02c767b

Browse files
committed
doc: clarify COPY TO for partitioning/inheritance
It was not clear how COPY TO behaved with partitioning/inheritancebecause the paragraphs were so far apart. Also reword to simplify.Discussion:https://postgr.es/m/20201203211723.GR24052@telsasoft.comAuthor: Justin PryzbyBackpatch-through: 10
1 parent41ddc27 commit02c767b

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

‎doc/src/sgml/ref/copy.sgml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,16 @@ COPY <replaceable class="parameter">count</replaceable>
413413
<title>Notes</title>
414414

415415
<para>
416-
<command>COPY TO</command> can only be used with plain tables, not
417-
with views. However, you can write <literal>COPY (SELECT * FROM
418-
<replaceable class="parameter">viewname</replaceable>) TO ...</literal>
419-
to copy the current contents of a view.
416+
<command>COPY TO</command> can be used only with plain
417+
tables, not views, and does not copy rows from child tables
418+
or child partitions. For example, <literal>COPY <replaceable
419+
class="parameter">table</replaceable> TO</literal> copies
420+
the same rows as <literal>SELECT * FROM ONLY <replaceable
421+
class="parameter">table</replaceable></literal>.
422+
The syntax <literal>COPY (SELECT * FROM <replaceable
423+
class="parameter">table</replaceable>) TO ...</literal> can be used to
424+
dump all of the rows in an inheritance hierarchy, partitioned table,
425+
or view.
420426
</para>
421427

422428
<para>
@@ -425,16 +431,6 @@ COPY <replaceable class="parameter">count</replaceable>
425431
<literal>INSTEAD OF INSERT</literal> triggers.
426432
</para>
427433

428-
<para>
429-
<command>COPY</command> only deals with the specific table named;
430-
it does not copy data to or from child tables. Thus for example
431-
<literal>COPY <replaceable class="parameter">table</replaceable> TO</literal>
432-
shows the same data as <literal>SELECT * FROM ONLY <replaceable
433-
class="parameter">table</replaceable></literal>. But <literal>COPY
434-
(SELECT * FROM <replaceable class="parameter">table</replaceable>) TO ...</literal>
435-
can be used to dump all of the data in an inheritance hierarchy.
436-
</para>
437-
438434
<para>
439435
You must have select privilege on the table
440436
whose values are read by <command>COPY TO</command>, and

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp