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