]> granicus.if.org Git - postgresql/commitdiff
Keep heap open until new heap generated in RMV.
authorKevin Grittner <kgrittn@postgresql.org>
Wed, 6 Nov 2013 18:27:52 +0000 (12:27 -0600)
committerKevin Grittner <kgrittn@postgresql.org>
Wed, 6 Nov 2013 18:27:52 +0000 (12:27 -0600)
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

index e3b0cbb708e1961333bc050de0053067af723d17..4a7805057e720d8a228da1c2141accb47b1f0d65 100644 (file)
@@ -239,8 +239,6 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
 
        owner = matviewRel->rd_rel->relowner;
 
-       heap_close(matviewRel, NoLock);
-
        /*
         * Create the transient table that will receive the regenerated data.
         * Lock it against access by any other process until commit (by which time
@@ -255,6 +253,8 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
        if (!stmt->skipData)
                refresh_matview_datafill(dest, dataQuery, queryString, owner);
 
+       heap_close(matviewRel, NoLock);
+
        /* Make the matview match the newly generated data. */
        if (concurrent)
        {