Skip to content

Commit bc06fae

Browse files
committed
Keep heap open until new heap generated in RMV.
Early close became apparent when invalidation messages were processed in a new location under CLOBBER_CACHE_ALWAYS builds, due to additional locking. Back-patch to 9.3
1 parent b474871 commit bc06fae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/commands/matview.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
208208

209209
tableSpace = matviewRel->rd_rel->reltablespace;
210210

211-
heap_close(matviewRel, NoLock);
212-
213211
/* Create the transient table that will receive the regenerated data. */
214212
OIDNewHeap = make_new_heap(matviewOid, tableSpace);
215213
dest = CreateTransientRelDestReceiver(OIDNewHeap);
@@ -218,6 +216,8 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
218216
if (!stmt->skipData)
219217
refresh_matview_datafill(dest, dataQuery, queryString);
220218

219+
heap_close(matviewRel, NoLock);
220+
221221
/*
222222
* Swap the physical files of the target and transient tables, then
223223
* rebuild the target's indexes and throw away the transient table.

0 commit comments

Comments
 (0)