Re: RLS makes COPY TO process child tables
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephen Frost <sfrost@snowman.net>
Cc: Yugo NAGATA <nagata@sraoss.co.jp>, Antonin Houska <ah@cybertec.at>,
pgsql-hackers@postgresql.org
Date: 2023-03-10T18:57:55Z
Lists: pgsql-hackers
Stephen Frost <sfrost@snowman.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
Commits
-
Ensure COPY TO on an RLS-enabled table copies no more than it should.
- d66bb048c313 16.0 landed
- a30310833d07 12.15 landed
- 866fd004d9f9 13.11 landed
- 6e2674d772b0 11.20 landed
- 59947bac7384 15.3 landed
- 53a53ea33213 14.8 landed