pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: When creating materialized views, use REFRESH to load data.
2+ messages / 1 participants
[nested] [flat]

* pgsql: When creating materialized views, use REFRESH to load data.
@ 2024-07-16 22:44  Jeff Davis <jdavis@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Jeff Davis @ 2024-07-16 22:44 UTC (permalink / raw)
  To: pgsql-committers@lists.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

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: When creating materialized views, use REFRESH to load data.
@ 2024-07-16 22:44  Jeff Davis <jdavis@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Jeff Davis @ 2024-07-16 22:44 UTC (permalink / raw)
  To: pgsql-committers@lists.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

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-07-16 22:44 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-07-16 22:44 pgsql: When creating materialized views, use REFRESH to load data. Jeff Davis <jdavis@postgresql.org>
2024-07-16 22:44 pgsql: When creating materialized views, use REFRESH to load data. Jeff Davis <jdavis@postgresql.org>

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