I need to execute CREATE MATERIALIZED VIEW ... WITH DATA from a function/procedure but I'm getting ERROR: CREATE MATERIALIZED VIEW ... WITH DATA cannot be executed from a function.
There is any workaround for this apart from making a function return the creation query text and copy paste it to execute it?
Seems really silly but I suppose there is a good reason behind it... Anyway, any workaround for this limitation?
I'm running postgresql 15.
WITH NO DATAand refresh them separately.WITH NO DATAit's a workaround that does the job even if you have to populate it manually later.