From e3044f6184beac395e88b4e1230e6c9d449db7f2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 18 Mar 2017 18:43:06 -0400 Subject: [PATCH] Avoid use of already-closed relcache entry. Oversight in commit 17f8ffa1e. Per buildfarm member prion. --- 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 c952dea6ea..8df3d1d81d 100644 --- a/src/backend/commands/matview.c +++ b/src/backend/commands/matview.c @@ -326,8 +326,6 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString, if (!stmt->skipData) processed = refresh_matview_datafill(dest, dataQuery, queryString); - heap_close(matviewRel, NoLock); - /* Make the matview match the newly generated data. */ if (concurrent) { @@ -361,6 +359,8 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString, pgstat_count_heap_insert(matviewRel, processed); } + heap_close(matviewRel, NoLock); + /* Roll back any GUC changes */ AtEOXact_GUC(false, save_nestlevel); -- 2.40.0