]> granicus.if.org Git - postgresql/commitdiff
Fix crash in CREATE UNLOGGED TABLE.
authorRobert Haas <rhaas@postgresql.org>
Fri, 17 Jun 2011 17:34:39 +0000 (13:34 -0400)
committerRobert Haas <rhaas@postgresql.org>
Fri, 17 Jun 2011 17:37:01 +0000 (13:37 -0400)
The code that created the init fork neglected to make sure that the
relation was open at the smgr level before attempting to invoke smgr.
This didn't happen every time; only when the relcache entry was rebuilt
along the way.

Per report from Garick Hamlin.

src/backend/catalog/heap.c

index 67a7749a30b265c46a590730595249af027931b0..e606ac2b9ed2fb50c058937a05e21b98494d67aa 100644 (file)
@@ -1295,6 +1295,7 @@ heap_create_with_catalog(const char *relname,
        {
                Assert(relkind == RELKIND_RELATION || relkind == RELKIND_TOASTVALUE);
 
+               RelationOpenSmgr(new_rel_desc);
                smgrcreate(new_rel_desc->rd_smgr, INIT_FORKNUM, false);
                if (XLogIsNeeded())
                        log_smgrcreate(&new_rel_desc->rd_smgr->smgr_rnode.node,