Hi.  My question is similar to one that was asked but apparently never
answered a couple of years ago on this list. (
https://www.postgresql.org/message-id/20160112023419.GA30965%40moraine.isi.edu
)

Basically, I'm wondering whether materialized views are likely to ever
support row-level security.

I've been toying with using MVs to address some performance issues, until
coming across this issue.

As explanation of the use case, I've got a DB that is shared across
multiple sites ("segments").  Each site is a different DB user, and access
to data is controlled by a function (has_segment_access).

So for a table, and a view, we use:

CREATE POLICY tbl_client_sites ON tbl_client FOR ALL USING
(has_segment_access(agency_segment_code));

CREATE VIEW client AS SELECT * FROM tbl_client WHERE
has_segment_access(agency_segment_code);

I'd been thinking I could just materialize some of these views, but then
they are frozen data, like a table.  But unlike a table, you can't apply
RLS.  Hence the email.  Any insight or development crystal-balling
appreciated.  Thanks!

Ken


-- 
AGENCY Software
A Free Software data system
By and for non-profits
*http://agency-software.org/ <http://agency-software.org/>*
*https://demo.agency-software.org/client
<https://demo.agency-software.org/client>*
ken.tan...@agency-software.org
(253) 245-3801

Subscribe to the mailing list
<agency-general-requ...@lists.sourceforge.net?body=subscribe> to
learn more about AGENCY or
follow the discussion.

Reply via email to