From bc06faeb78c0e66927cd04f46ed8b5d41ab18427 Mon Sep 17 00:00:00 2001 From: Kevin Grittner Date: Wed, 6 Nov 2013 12:26:36 -0600 Subject: [PATCH] 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 --- src/backend/commands/matview.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c index f7b3244752..acf9564c33 100644 --- a/src/backend/commands/matview.c +++ b/src/backend/commands/matview.c @@ -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. -- 2.40.0