Subject: RLS and Table Inheritance

From: Sanjay Minni <[email-masked]>
Date: Thu, 12 Sep 2024 18:49:07 +0530

Hi,

Do RLS policies defined at the parent, work on the child (in Table
inheritance).
At the parent I have a column 'site_id' with an RLS policy that only rows
with site_id = current_setting(curr_site_id) would be accessible.
However the policy defined at the parent does not work for me in inherited
tables. Is it intended that way ?
Is there a solution to reflect the RLS policy along the line of
inheritance, else i have to redefine the RLS policy at each inherited table
(a significant maintenance effort).

In another post I see conflicting views on this
https://www.postgresql.org/message-id/[email-masked]
.
While the original post seemed to get a prototype working,  the response
says that RLS policy will not be inherited and needs to be reimplemented at
each table.

thanks
Sanjay

---

From: Tom Lane <[email-masked]>
Date: Thu, 12 Sep 2024 10:19:48 -0400

> tables. Is it intended that way ?

If you mean when accessing the child tables directly, yes.

			regards, tom lane