Commit 21e28e45 authored by Robert Haas's avatar Robert Haas

Fix cache flush hazard in ExecRefreshMatView.

Andres Freund
parent 2e44770f
......@@ -141,6 +141,7 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
List *actions;
Query *dataQuery;
Oid tableSpace;
Oid owner;
Oid OIDNewHeap;
DestReceiver *dest;
bool concurrent;
......@@ -238,6 +239,8 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
else
tableSpace = matviewRel->rd_rel->reltablespace;
owner = matviewRel->rd_rel->relowner;
heap_close(matviewRel, NoLock);
/* Create the transient table that will receive the regenerated data. */
......@@ -247,8 +250,7 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
/* Generate the data, if wanted. */
if (!stmt->skipData)
refresh_matview_datafill(dest, dataQuery, queryString,
matviewRel->rd_rel->relowner);
refresh_matview_datafill(dest, dataQuery, queryString, owner);
/* Make the matview match the newly generated data. */
if (concurrent)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment