RLS and Table Inheritance

From: Sanjay Minni <sanjay(dot)minni(at)gmail(dot)com>
To: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: RLS and Table Inheritance
Date: 2024-09-12 13:19:07
Message-ID: CAMpxBomfErwT=ETjdzrVM9Kys8E3xZ2Lge9kY_SahyOCtX8dCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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/d094a87d-9d63-46c9-8c27-631f881b80fb@supportex.net
.
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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Joseph Krogh 2024-09-12 13:21:49 Re: Effects of REVOKE SELECT ON ALL TABLES IN SCHEMA pg_catalog FROM PUBLIC
Previous Message Dominique Devienne 2024-09-12 13:11:59 Re: Effects of REVOKE SELECT ON ALL TABLES IN SCHEMA pg_catalog FROM PUBLIC