copy.sgml and partitioned tables

Поиск
Список
Период
Сортировка
Искать

copy.sgml and partitioned tables

От:
Justin Pryzby <pryzby@telsasoft.com>
Дата:
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."

diff --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 count
 
    
     COPY TO can only be used with plain tables, not
-    with views.  However, you can write COPY (SELECT * FROM
-    viewname) TO ...
-    to copy the current contents of a view.
+    views, and does not copy data from child tables or partitions.
+    Thus for example
+    COPY table TO
+    shows the same data as SELECT * FROM ONLY table.  But COPY
+    (SELECT * FROM table) TO ...
+    can be used to dump all of the data in an inheritance hierarchy,
+    partitioned table, or view.
    
 
    
@@ -425,16 +430,6 @@ COPY count
     INSTEAD OF INSERT triggers.
    
 
-   
-    COPY only deals with the specific table named;
-    it does not copy data to or from child tables.  Thus for example
-    COPY table TO
-    shows the same data as SELECT * FROM ONLY table.  But COPY
-    (SELECT * FROM table) TO ...
-    can be used to dump all of the data in an inheritance hierarchy.
-   
-
    
     You must have select privilege on the table
     whose values are read by COPY TO, and


Re: copy.sgml and partitioned tables

От:
Bruce Momjian <bruce@momjian.us>
Дата:
Вложения:
On Thu, Dec  3, 2020 at 03:17:23PM -0600, Justin Pryzby wrote:
> 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."

I reworded it slightly, attached, and applied it back to PG 10, where we
added the partition syntax.

-- 
  Bruce Momjian          https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee

FAQ