pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: When creating materialized views, use REFRESH to load data.
Date: Tue, 16 Jul 2024 22:44:15 +0000
Message-ID: <E1sTqu7-001x1z-Sw@gemulon.postgresql.org> (raw)

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
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b4da732fd64e936970f38c792f8b32c4bdf2bcd5

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(-)



view thread (2+ messages)

Message-ID: <E1sTqu7-001x1z-Sw@gemulon.postgresql.org>
Permalink:  ../E1sTqu7-001x1z-Sw@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sTqu7-001x1z-Sw@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: When creating materialized views, use REFRESH to load data.
  In-Reply-To: <E1sTqu7-001x1z-Sw@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox