]> granicus.if.org Git - postgresql/commitdiff
Avoid use of already-closed relcache entry.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 Mar 2017 22:43:06 +0000 (18:43 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 Mar 2017 22:43:06 +0000 (18:43 -0400)
Oversight in commit 17f8ffa1e.  Per buildfarm member prion.

src/backend/commands/matview.c

index c952dea6ead81ca6986d340072253932d6a35900..8df3d1d81dd751e09ce3eaa35bd26a6482374786 100644 (file)
@@ -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);