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