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, ...@@ -141,6 +141,7 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
List *actions; List *actions;
Query *dataQuery; Query *dataQuery;
Oid tableSpace; Oid tableSpace;
Oid owner;
Oid OIDNewHeap; Oid OIDNewHeap;
DestReceiver *dest; DestReceiver *dest;
bool concurrent; bool concurrent;
...@@ -238,6 +239,8 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString, ...@@ -238,6 +239,8 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
else else
tableSpace = matviewRel->rd_rel->reltablespace; tableSpace = matviewRel->rd_rel->reltablespace;
owner = matviewRel->rd_rel->relowner;
heap_close(matviewRel, NoLock); heap_close(matviewRel, NoLock);
/* Create the transient table that will receive the regenerated data. */ /* Create the transient table that will receive the regenerated data. */
...@@ -247,8 +250,7 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString, ...@@ -247,8 +250,7 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
/* Generate the data, if wanted. */ /* Generate the data, if wanted. */
if (!stmt->skipData) if (!stmt->skipData)
refresh_matview_datafill(dest, dataQuery, queryString, refresh_matview_datafill(dest, dataQuery, queryString, owner);
matviewRel->rd_rel->relowner);
/* Make the matview match the newly generated data. */ /* Make the matview match the newly generated data. */
if (concurrent) 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