When creating materialized views, use REFRESH to load data.
Jeff Davis <jdavis@postgresql.org>
When creating materialized views, use REFRESH to load data. Previously, CREATE MATERIALIZED VIEW ... WITH DATA populated the MV the same way as CREATE TABLE ... AS. Instead, reuse the REFRESH logic, which locks down security-restricted operations and restricts the search_path. This reduces the chance that a subsequent refresh will fail. Reported-by: Noah Misch Backpatch-through: 17 Discussion: https://postgr.es/m/20240630222344.db.nmisch@google.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/createas.c | modified | +15 −17 |
| src/backend/commands/matview.c | modified | +40 −24 |
| src/include/commands/matview.h | modified | +3 −0 |
| src/test/regress/expected/namespace.out | modified | +2 −2 |
Discussion
- MAINTAIN privilege -- what do we need to un-revert it? 30 messages · 2024-02-14 → 2024-09-27