1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-25 21:42:33 +03:00

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
This commit is contained in:
Kevin Grittner 2013-11-06 12:26:36 -06:00
parent b474871385
commit bc06faeb78

View File

@ -208,8 +208,6 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
tableSpace = matviewRel->rd_rel->reltablespace;
heap_close(matviewRel, NoLock);
/* Create the transient table that will receive the regenerated data. */
OIDNewHeap = make_new_heap(matviewOid, tableSpace);
dest = CreateTransientRelDestReceiver(OIDNewHeap);
@ -218,6 +216,8 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
if (!stmt->skipData)
refresh_matview_datafill(dest, dataQuery, queryString);
heap_close(matviewRel, NoLock);
/*
* Swap the physical files of the target and transient tables, then
* rebuild the target's indexes and throw away the transient table.