summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2011-06-17 13:34:39 -0400
committerRobert Haas <rhaas@postgresql.org>2011-06-17 13:37:01 -0400
commitae31b59512746a2cc397b70b8a05106e7a7f8ed3 (patch)
treee7765f40416cf67b78dea7e60c2940c4d5d586f7
parenta3903f1bf8e3ecd0589725ed1efbc9208d03f336 (diff)
Fix crash in CREATE UNLOGGED TABLE.
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.
-rw-r--r--src/backend/catalog/heap.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 67a7749a30b..e606ac2b9ed 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -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,