Skip to content

Commit 21e28e4

Browse files
committed
Fix cache flush hazard in ExecRefreshMatView.
Andres Freund
1 parent 2e44770 commit 21e28e4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/commands/matview.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
141141
List *actions;
142142
Query *dataQuery;
143143
Oid tableSpace;
144+
Oid owner;
144145
Oid OIDNewHeap;
145146
DestReceiver *dest;
146147
bool concurrent;
@@ -238,6 +239,8 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
238239
else
239240
tableSpace = matviewRel->rd_rel->reltablespace;
240241

242+
owner = matviewRel->rd_rel->relowner;
243+
241244
heap_close(matviewRel, NoLock);
242245

243246
/* Create the transient table that will receive the regenerated data. */
@@ -247,8 +250,7 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
247250

248251
/* Generate the data, if wanted. */
249252
if (!stmt->skipData)
250-
refresh_matview_datafill(dest, dataQuery, queryString,
251-
matviewRel->rd_rel->relowner);
253+
refresh_matview_datafill(dest, dataQuery, queryString, owner);
252254

253255
/* Make the matview match the newly generated data. */
254256
if (concurrent)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy