mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +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:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user