Re: AW: Why is materialized view creation a "security-restricted operation"?

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Färber, "Franz-Josef (StMUK)" <Franz-Josef(dot)Faerber(at)stmuk(dot)bayern(dot)de>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Cc: "Haupt, Matthias (StMUK)" <Matthias(dot)Haupt(at)stmuk(dot)bayern(dot)de>
Subject: Re: AW: Why is materialized view creation a "security-restricted operation"?
Date: 2026-10-13 13:47:40
Message-ID: c9f4e4a615b076199779deb84203c8a0dd095e3e.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2026-10-13 at 11:36 +0000, Färber, Franz-Josef (StMUK) wrote:
> > > [rant about PostgreSQL security restrictions]
>
> No no no, not about security restrictions. The rant is about lacking orthogonality.
> About often NOT being able to combine language features. Doesn't anybody share that
> view? We COULD do better, I think.

Well, you want to use a materialized view for something that it cannot be used
for, for security reasons. We tried to explain that in this thread.

> > If the security restrictions of materialized views prevent you from using them,
> > why don't you use a normal table instead, TRUNCATE it and INSERT into it?
>
> The MAT VIEW is used from "outside". From other views, or from a client that connects to the database.
>
> * I can replace it with a view; I didn't do that for performance reasons.
> * I can replace it with a persistent table, a stored procedure, and custom caching
> logic. That'll work. But this is what a MAT VIEW is for, I thought.

You could write a procedure that truncates the table and populates it with
a query, using a temporary table if you want. Calling that procedure is just
as convenient as calling REFRESH MATERIALIZED VIEW.

Are you searching for a usable solution for a problem? Then that should do.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message 2026-10-13 14:17:25 AW: AW: Why is materialized view creation a "security-restricted operation"?
Previous Message 2026-10-13 11:36:48 AW: Why is materialized view creation a "security-restricted operation"?