summaryrefslogtreecommitdiff
path: root/src/backend/commands/tablespace.c
diff options
context:
space:
mode:
authorTom Lane2004-06-21 04:06:07 +0000
committerTom Lane2004-06-21 04:06:07 +0000
commitf5f448fb3e6896584a240ca8e5c2fd616212fbf6 (patch)
tree6ac568df532f483d2f6777b7bd981f5c28f59c8d /src/backend/commands/tablespace.c
parent483b7f8249f14133899057c7f6e6378b497c064e (diff)
Rename the built-in tablespaces to pg_default and pg_global, and prohibit
creation of user-defined tablespaces with names starting with 'pg_', as per suggestion of Chris K-L. Also install admin-guide tablespace documentation from Gavin.
Diffstat (limited to 'src/backend/commands/tablespace.c')
-rw-r--r--src/backend/commands/tablespace.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index d00c01ce17a..61e36d5b5c2 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -19,8 +19,8 @@
* Thus the full path to an arbitrary file is
* $PGDATA/pg_tblspc/spcoid/dboid/relfilenode
*
- * There are two tablespaces created at initdb time: global (for shared
- * tables) and default (for everything else). For backwards compatibility
+ * There are two tablespaces created at initdb time: pg_global (for shared
+ * tables) and pg_default (for everything else). For backwards compatibility
* and to remain functional on platforms without symlinks, these tablespaces
* are accessed specially: they are respectively
* $PGDATA/global/relfilenode
@@ -45,7 +45,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.2 2004/06/21 01:04:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.3 2004/06/21 04:06:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -234,6 +234,17 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
location)));
/*
+ * Disallow creation of tablespaces named "pg_xxx"; we reserve this
+ * namespace for system purposes.
+ */
+ if (!allowSystemTableMods && IsReservedName(stmt->tablespacename))
+ ereport(ERROR,
+ (errcode(ERRCODE_RESERVED_NAME),
+ errmsg("unacceptable tablespace name \"%s\"",
+ stmt->tablespacename),
+ errdetail("The prefix \"pg_\" is reserved for system tablespaces.")));
+
+ /*
* Check that there is no other tablespace by this name. (The
* unique index would catch this anyway, but might as well give
* a friendlier message.)