diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-21 04:06:07 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-21 04:06:07 +0000 |
commit | f5f448fb3e6896584a240ca8e5c2fd616212fbf6 (patch) | |
tree | 6ac568df532f483d2f6777b7bd981f5c28f59c8d /src | |
parent | 483b7f8249f14133899057c7f6e6378b497c064e (diff) | |
download | postgresql-f5f448fb3e6896584a240ca8e5c2fd616212fbf6.tar.gz postgresql-f5f448fb3e6896584a240ca8e5c2fd616212fbf6.zip |
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')
-rw-r--r-- | src/backend/catalog/catalog.c | 9 | ||||
-rw-r--r-- | src/backend/commands/tablespace.c | 17 | ||||
-rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
-rw-r--r-- | src/include/catalog/pg_tablespace.h | 6 |
4 files changed, 23 insertions, 13 deletions
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c index 9ca8b135b4c..2305d10db32 100644 --- a/src/backend/catalog/catalog.c +++ b/src/backend/catalog/catalog.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.53 2004/06/21 01:04:41 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.54 2004/06/21 04:06:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -119,8 +119,7 @@ GetDatabasePath(Oid dbNode, Oid spcNode) * * We now just test if the relation is in the system catalog namespace; * so it's no longer necessary to forbid user relations from having - * names starting with pg_. Now only schema names have the pg_ - * distinction/requirement. + * names starting with pg_. */ bool IsSystemRelation(Relation relation) @@ -200,8 +199,8 @@ IsToastNamespace(Oid namespaceId) * True iff name starts with the pg_ prefix. * * For some classes of objects, the prefix pg_ is reserved for - * system objects only. As of 7.3, this is now only true for - * schema names. + * system objects only. As of 7.5, this is only true for + * schema and tablespace names. */ bool IsReservedName(const char *name) 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.) diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index fc4ed22ba4a..8bb47ad78c7 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.238 2004/06/21 01:04:45 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.239 2004/06/21 04:06:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200406201 +#define CATALOG_VERSION_NO 200406202 #endif diff --git a/src/include/catalog/pg_tablespace.h b/src/include/catalog/pg_tablespace.h index f05d3657704..1378d9987b7 100644 --- a/src/include/catalog/pg_tablespace.h +++ b/src/include/catalog/pg_tablespace.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_tablespace.h,v 1.1 2004/06/18 06:14:06 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_tablespace.h,v 1.2 2004/06/21 04:06:07 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -57,8 +57,8 @@ typedef FormData_pg_tablespace *Form_pg_tablespace; #define Anum_pg_tablespace_spclocation 3 #define Anum_pg_tablespace_spcacl 4 -DATA(insert OID = 1663 ( default PGUID "" _null_ )); -DATA(insert OID = 1664 ( global PGUID "" _null_ )); +DATA(insert OID = 1663 ( pg_default PGUID "" _null_ )); +DATA(insert OID = 1664 ( pg_global PGUID "" _null_ )); #define DEFAULTTABLESPACE_OID 1663 #define GLOBALTABLESPACE_OID 1664 |