aboutsummaryrefslogtreecommitdiff
path: root/src/backend/catalog/heap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/catalog/heap.c')
-rw-r--r--src/backend/catalog/heap.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index cbf05acfb83..ea985a635dd 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.323 2007/09/08 20:31:14 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.324 2007/10/12 18:55:11 tgl Exp $
*
*
* INTERFACE ROUTINES
@@ -43,6 +43,7 @@
#include "catalog/pg_inherits.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_statistic.h"
+#include "catalog/pg_tablespace.h"
#include "catalog/pg_type.h"
#include "commands/tablecmds.h"
#include "commands/typecmds.h"
@@ -834,6 +835,25 @@ heap_create_with_catalog(const char *relname,
}
/*
+ * Validate shared/non-shared tablespace (must check this before doing
+ * GetNewRelFileNode, to prevent Assert therein)
+ */
+ if (shared_relation)
+ {
+ if (reltablespace != GLOBALTABLESPACE_OID)
+ /* elog since this is not a user-facing error */
+ elog(ERROR,
+ "shared relations must be placed in pg_global tablespace");
+ }
+ else
+ {
+ if (reltablespace == GLOBALTABLESPACE_OID)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("only shared relations can be placed in pg_global tablespace")));
+ }
+
+ /*
* Allocate an OID for the relation, unless we were told what to use.
*
* The OID will be the relfilenode as well, so make sure it doesn't