1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-13 14:22:43 +03:00

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.
This commit is contained in:
Tom Lane
2004-06-21 04:06:07 +00:00
parent 483b7f8249
commit f5f448fb3e
7 changed files with 140 additions and 117 deletions

View File

@@ -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)

View File

@@ -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 $
*
*-------------------------------------------------------------------------
*/
@@ -233,6 +233,17 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
errmsg("tablespace location \"%s\" is too long",
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

View File

@@ -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

View File

@@ -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