RLS makes COPY TO process child tables
Antonin Houska <ah@cybertec.at>
From: Antonin Houska <ah@cybertec.at>
To: pgsql-hackers@postgresql.org
Date: 2023-02-01T11:45:57Z
Lists: pgsql-hackers
Attachments
- (unnamed) (text/plain)
- copy_rls_no_inh.diff (text/x-diff) patch
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: "COPY TO can be used only with plain tables, not views, and does not copy rows from child tables or child partitions. For example, COPY table TO copies the same rows as SELECT * FROM ONLY table. The syntax COPY (SELECT * FROM table) TO ... can be used to dump all of the rows in an inheritance hierarchy, partitioned table, or view." A test case is attached (rls.sql) as well as fix proposal (copy_rls_no_inh.diff). [1] https://commitfest.postgresql.org/41/3641/ -- Antonin Houska Web: https://www.cybertec-postgresql.com
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