Re: RLS makes COPY TO process child tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>, Antonin Houska <ah(at)cybertec(dot)at>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: RLS makes COPY TO process child tables
Date: 2023-03-10 18:57:55
Message-ID: 978238.1678474675@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephen Frost <sfrost(at)snowman(dot)net> 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2023-03-10 18:58:49 Re: pgsql: Use ICU by default at initdb time.
Previous Message Jehan-Guillaume de Rorthais 2023-03-10 18:51:14 Re: Memory leak from ExecutorState context?