Will there ever be support for Row Level Security on Materialized Views? - Mailing list pgsql-general

From Ken Tanzer
Subject Will there ever be support for Row Level Security on Materialized Views?
Date
Msg-id CAD3a31XAm0VF0LMH-rOEkqaJmYrzbh2RYCe3c4p9k_rwzsR7pg@mail.gmail.com
Whole thread Raw
Responses Re: Will there ever be support for Row Level Security on Materialized Views?
List pgsql-general
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
(253) 245-3801

learn more about AGENCY or
follow the discussion.

pgsql-general by date:

Previous
From: Michal
Date:
Subject: Re: Immutable function WAY slower than Stable function?
Next
From: 김세훈
Date:
Subject: using graph model with PostgreSQL