diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-11-05 19:17:13 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-11-05 19:17:13 +0000 |
| commit | 98e8b4805324d8ba0b196b8ffaafd5ddd3051ea1 (patch) | |
| tree | 61d027f5621f3ff37a675fb2e9982e0d28a81242 /src/backend/commands/schemacmds.c | |
| parent | 0ed3c7665e2fe46efd3eef936a1265be2ec6707f (diff) | |
| download | postgresql-98e8b4805324d8ba0b196b8ffaafd5ddd3051ea1.tar.gz | |
Create 'default_tablespace' GUC variable that supplies a TABLESPACE
clause implicitly whenever one is not given explicitly. Remove concept
of a schema having an associated tablespace, and simplify the rules for
selecting a default tablespace for a table or index. It's now just
(a) explicit TABLESPACE clause; (b) default_tablespace if that's not an
empty string; (c) database's default. This will allow pg_dump to use
SET commands instead of tablespace clauses to determine object locations
(but I didn't actually make it do so). All per recent discussions.
Diffstat (limited to 'src/backend/commands/schemacmds.c')
| -rw-r--r-- | src/backend/commands/schemacmds.c | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c index b4e1cd7798..fc2410bacc 100644 --- a/src/backend/commands/schemacmds.c +++ b/src/backend/commands/schemacmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.25 2004/09/02 00:22:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.26 2004/11/05 19:15:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -23,7 +23,6 @@ #include "catalog/pg_namespace.h" #include "commands/dbcommands.h" #include "commands/schemacmds.h" -#include "commands/tablespace.h" #include "miscadmin.h" #include "parser/analyze.h" #include "tcop/utility.h" @@ -42,7 +41,6 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) const char *schemaName = stmt->schemaname; const char *authId = stmt->authid; Oid namespaceId; - Oid tablespaceId; List *parsetree_list; ListCell *parsetree_item; const char *owner_name; @@ -102,35 +100,8 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) errmsg("unacceptable schema name \"%s\"", schemaName), errdetail("The prefix \"pg_\" is reserved for system schemas."))); - /* - * Select default tablespace for schema. If not given, use zero which - * implies the database's default tablespace. - */ - if (stmt->tablespacename) - { - AclResult aclresult; - - tablespaceId = get_tablespace_oid(stmt->tablespacename); - if (!OidIsValid(tablespaceId)) - ereport(ERROR, - (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("tablespace \"%s\" does not exist", - stmt->tablespacename))); - /* check permissions */ - aclresult = pg_tablespace_aclcheck(tablespaceId, GetUserId(), - ACL_CREATE); - if (aclresult != ACLCHECK_OK) - aclcheck_error(aclresult, ACL_KIND_TABLESPACE, - stmt->tablespacename); - } - else - { - tablespaceId = InvalidOid; - /* note there is no permission check in this path */ - } - /* Create the schema's namespace */ - namespaceId = NamespaceCreate(schemaName, owner_userid, tablespaceId); + namespaceId = NamespaceCreate(schemaName, owner_userid); /* Advance cmd counter to make the namespace visible */ CommandCounterIncrement(); |
