pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: pgsql-hackers@lists.postgresql.org
Subject: copy.sgml and partitioned tables
Date: Thu, 3 Dec 2020 15:17:23 -0600
Message-ID: <20201203211723.GR24052@telsasoft.com> (raw)

https://www.postgresql.org/docs/current/sql-copy.html
|. COPY FROM can be used with plain, foreign, or partitioned tables or with views that have INSTEAD OF INSERT triggers.
|. COPY only deals with the specific table named; IT DOES NOT COPY DATA TO OR FROM CHILD TABLES. ...

That language in commit 854b5eb51 was never updated since partitioning was
added, so I propose this.

I'm not sure, but maybe it should still say that "COPY TO does not copy data to
child tables of inheritance hierarchies."

inline patch 1: doc/src/sgml/ref/copy.sgml (+8/-13 lines) download inline-1.patchdiff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index 369342b74d..0631dfe6b3 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -414,9 +414,14 @@ COPY <replaceable class="parameter">count</replaceable> <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. + views, and does not copy data from child tables or partitions. + 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, + partitioned table, or view. </para> <para> @@ -425,16 +430,6 @@ COPY <replaceable class="parameter">count</replaceable> <literal>INSTEAD OF INSERT</literal> triggers. </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

view thread (2+ messages)  latest in thread

Message-ID: <20201203211723.GR24052@telsasoft.com>
Permalink:  ../20201203211723.GR24052@telsasoft.com/
Also on:    postgresql.org/message-id/20201203211723.GR24052@telsasoft.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: copy.sgml and partitioned tables
  In-Reply-To: <20201203211723.GR24052@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox