Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+4-2
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)