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 1pahwL-00077o-RZ for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Mar 2023 18:58:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pahwK-0005nG-EL for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Mar 2023 18:58:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pahwK-0005n7-4g for pgsql-hackers@lists.postgresql.org; Fri, 10 Mar 2023 18:58:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pahwD-0004hO-IH for pgsql-hackers@postgresql.org; Fri, 10 Mar 2023 18:58:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 32AIvthB978240; Fri, 10 Mar 2023 13:57:55 -0500 From: Tom Lane To: Stephen Frost cc: Yugo NAGATA , Antonin Houska , pgsql-hackers@postgresql.org Subject: Re: RLS makes COPY TO process child tables In-reply-to: References: <3472.1675251957@antos> <20230202011525.c7c05900bcf791f868d72a51@sraoss.co.jp> <1379089.1675270043@sss.pgh.pa.us> <20230202160031.defd38f35433c7677b48a8ec@sraoss.co.jp> Comments: In-reply-to Stephen Frost message dated "Tue, 07 Feb 2023 20:02:05 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <978237.1678474675.1@sss.pgh.pa.us> Date: Fri, 10 Mar 2023 13:57:55 -0500 Message-ID: <978238.1678474675@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Stephen Frost writes: > Yeah, that should also be updated. Perhaps you'd send an updated patch > which includes fixing that too and maybe adds clarifying documentation > to COPY which mentions what happens when RLS is enabled on the relation? I couldn't find anything in copy.sgml that seemed to need adjustment. It already says If row-level security is enabled for the table, the relevant SELECT policies will apply to COPY table TO statements. Together with the already-mentioned COPY table TO copies the same rows as SELECT * FROM ONLY table. I'd say that the behavior is very clearly specified already. We just need to make the code do what the docs say. So I pushed the patch without any docs changes. I did add a test case, because I don't like back-patching without something that proves that the issue is relevant to, and corrected in, each branch. regards, tom lane