pgsql: When creating materialized views, use REFRESH to load data. - Mailing list pgsql-committers

From Jeff Davis
Subject pgsql: When creating materialized views, use REFRESH to load data.
Date
Msg-id E1sTqu2-001x1O-JH@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4b74ebf726d444ba820830cad986a1f92f724649

Modified Files
--------------
src/backend/commands/createas.c         | 32 ++++++++---------
src/backend/commands/matview.c          | 64 ++++++++++++++++++++-------------
src/include/commands/matview.h          |  3 ++
src/test/regress/expected/namespace.out |  4 +--
4 files changed, 60 insertions(+), 43 deletions(-)


pgsql-committers by date:

Previous
From: Nathan Bossart
Date:
Subject: pgsql: Add a couple of recent commits to .git-blame-ignore-revs.
Next
From: Jeff Davis
Date:
Subject: pgsql: When creating materialized views, use REFRESH to load data.