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

Commitde7b034

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 parentfde5f13 commitde7b034

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
@@ -411,10 +411,16 @@ COPY <replaceable class="parameter">count</replaceable>
411411
<title>Notes</title>
412412

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

420426
<para>
@@ -423,16 +429,6 @@ COPY <replaceable class="parameter">count</replaceable>
423429
<literal>INSTEAD OF INSERT</literal> triggers.
424430
</para>
425431

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp