From 9595b06ef7363bf6ca42906e0007a82ab5da0950 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 15 Dec 2020 19:20:14 -0500 Subject: [PATCH] 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 --- doc/src/sgml/ref/copy.sgml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index 5f7d32a99b5..085a380d0f1 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -396,10 +396,16 @@ COPY count Notes - 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. + COPY TO can be used only with plain + tables, not views, and does not copy rows from child tables + or child partitions. For example, COPY table TO copies + the same rows as SELECT * FROM ONLY table. + The syntax COPY (SELECT * FROM table) TO ... can be used to + dump all of the rows in an inheritance hierarchy, partitioned table, + or view. @@ -407,16 +413,6 @@ COPY count that have 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