Will there ever be support for Row Level Security on Materialized Views?

From: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
To: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Will there ever be support for Row Level Security on Materialized Views?
Date: 2018-08-15 00:24:26
Message-ID: CAD3a31XAm0VF0LMH-rOEkqaJmYrzbh2RYCe3c4p9k_rwzsR7pg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
*http://agency-software.org/ <http://agency-software.org/>*
*https://demo.agency-software.org/client
<https://demo.agency-software.org/client>*
ken(dot)tanzer(at)agency-software(dot)org
(253) 245-3801

Subscribe to the mailing list
<agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe> to
learn more about AGENCY or
follow the discussion.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message dangal 2018-08-15 01:00:00 Re: How to revoke privileged from PostgreSQL's superuser
Previous Message Michal 2018-08-14 23:40:17 Re: Immutable function WAY slower than Stable function?