Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkvym-0004TV-HH for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Dec 2020 21:17:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kkvyl-0004jI-Dl for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Dec 2020 21:17:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkvyl-0004jB-3P for pgsql-hackers@lists.postgresql.org; Thu, 03 Dec 2020 21:17:31 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kkvyh-0002Q1-SK for pgsql-hackers@lists.postgresql.org; Thu, 03 Dec 2020 21:17:30 +0000 Received: by mail-il1-x129.google.com with SMTP id t13so3305405ilp.2 for ; Thu, 03 Dec 2020 13:17:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=Y/yVneu7pxbCZmW/J1HTav6yu0KB8YhVDOMkTH2BqPw=; b=XOKXhqYM/PhLpNrT7SOLUkUHpKOHUnftj6fUwSBNUagOx4qWpYAYrUOybDl0oo4D+1 lRcNRTQFl8YYNvZ0GVMBU9+GRvU3f4pr3AH8E0iLZ35uhyaANwPpJX/F9A0bCrg6meSx dOuJne/cDXTlC1cr6cgXrWbE6B3B6xi6eonofrDlenh6O67Meo7T8HeAg0MuSrFFkwz3 vKh/vrDnr0WHKIb0zdVs+mCjE3K8YCXjKe+5yrNh2aZFdS9sk0vq3Wn2Yb8eeQyEKvM9 577OVcCHDxKjJMcAy9VyEmKttRyUgEE2ZFcI5fmhHEwq/1ePxOqWSDsgYAkFaCkkX6/Z +Hzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=Y/yVneu7pxbCZmW/J1HTav6yu0KB8YhVDOMkTH2BqPw=; b=sW5qsyGdejCSN/Ge/rFkLdh341wL60+kSUgRWPXKRtaLxMEKy/iM3mVR9EHy7PQJHw t5CO+lVmIsXvHcJyoa0TN6Zou5udAcBzG+yQapZOwLvMx9rQBed2vNAfdtHHEzNZ3eIn riWgV7pEq9M9Vo6kZ3TVut1y3SIgVkFNtAVrwWVvIV+oG4Em23A9DntC8b6F9JHXrB5H HVmDqn32mYV8lnKvT3uNCHNkOdTC0amVGy9Z6xkVsN1sUCp1/CKg8k/6gxJMec2Npqwu +SToBL6Y68Lo7zBwN9wy6LzPk2ejYAItaeGUlb92CkyTkB5cYot8mKjzdp3jpiEtcO4R xRSA== X-Gm-Message-State: AOAM531K5PIxFVMPEZIx3SZHMm/3q47jsdjuFhn1Co69zLHZzuI0xopL a3N6GvRtZCFRCP7/3ALmtwB/p3NC81y1Dokn X-Google-Smtp-Source: ABdhPJyrQq1dVTtEJILUXNyxGGAzki+NBFkGQoahGEQ0jW3a+etJYFbIQnqJ+TmRuQQQQAo9k29U5Q== X-Received: by 2002:a92:360a:: with SMTP id d10mr1452462ila.198.1607030245743; Thu, 03 Dec 2020 13:17:25 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id v63sm231351ioe.52.2020.12.03.13.17.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Dec 2020 13:17:24 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id E211A80087C; Thu, 3 Dec 2020 15:17:23 -0600 (CST) Date: Thu, 3 Dec 2020 15:17:23 -0600 From: Justin Pryzby To: pgsql-hackers@lists.postgresql.org Subject: copy.sgml and partitioned tables Message-ID: <20201203211723.GR24052@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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