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

From: Joshua Chamberlain <josh(at)zephyri(dot)co>
To: pgsql-general(at)postgresql(dot)org
Subject: Why is materialized view creation a "security-restricted operation"?
Date: 2017-01-23 19:06:19
Message-ID: CAFBoRzf6HwFg1jovdOrbtC6x4xKV__-t5EjSzbY2068S01pcTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I see this has been discussed briefly before[1], but I'm still not clear on
what's happening and why.

I wrote a function that uses temporary tables in generating a result set. I
can use it when creating tables or views, e.g.,
CREATE TABLE some_table AS SELECT * FROM my_func();
CREATE VIEW some_view AS SELECT * FROM my_func();

But creating a materialized view fails:
CREATE MATERIALIZED VIEW some_view AS SELECT * FROM my_func();
ERROR: cannot create temporary table within security-restricted operation

The docs explain that this is expected[2], but not why. On the contrary,
this is actually quite surprising to me, given that tables and views work
just fine. What makes a materialized view so different? Are there any plans
to make this more consistent?

Thanks for any help you can provide.

Regards,
Joshua Chamberlain

[1]
https://www.postgresql.org/message-id/CAFjFpRcz3qKQFQo3RynfPinXdOp_42Tz%2BxCqBQdAoe061bMRSw%40mail.gmail.com
[2]
https://www.postgresql.org/docs/9.3/static/sql-creatematerializedview.html

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Israel Brewster 2017-01-23 22:45:21 Re: pg_dump Conflict with recovery
Previous Message Jerry Sievers 2017-01-23 19:06:01 Re: pg_dump Conflict with recovery