Re: RLS makes COPY TO process child tables
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Yugo NAGATA <nagata@sraoss.co.jp>
Cc: Antonin Houska <ah@cybertec.at>, pgsql-hackers@postgresql.org
Date: 2023-02-01T16:47:23Z
Lists: pgsql-hackers
Yugo NAGATA <nagata@sraoss.co.jp> writes: > Antonin Houska <ah@cybertec.at> wrote: >> While working on [1] I noticed that if RLS gets enabled, the COPY TO command >> includes the contents of child table into the result, although the >> documentation says it should not: > I think this is a bug because the current behaviour is different from > the documentation. I agree, it shouldn't do that. > When RLS is enabled on a table in `COPY ... TO ...`, the query is converted > to `COPY (SELECT * FROM ...) TO ...` to allow the rewriter to add in RLS > clauses. This causes to dump the rows of child tables. Do we actually say that in so many words, either in the code or docs? If so, it ought to read `COPY (SELECT * FROM ONLY ...) TO ...` instead. (If we say that in the docs, then arguably the code *does* conform to the docs. But I don't see it in the COPY ref page at least.) 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