summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2004-11-05 19:17:13 +0000
committerTom Lane2004-11-05 19:17:13 +0000
commit98e8b4805324d8ba0b196b8ffaafd5ddd3051ea1 (patch)
tree61d027f5621f3ff37a675fb2e9982e0d28a81242 /src/include
parent0ed3c7665e2fe46efd3eef936a1265be2ec6707f (diff)
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/include')
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/catalog/pg_namespace.h17
-rw-r--r--src/include/commands/tablespace.h5
-rw-r--r--src/include/nodes/parsenodes.h3
-rw-r--r--src/include/utils/guc.h6
-rw-r--r--src/include/utils/lsyscache.h4
6 files changed, 20 insertions, 19 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 32c097eeb0..25e34f8153 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.251 2004/10/11 17:24:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.252 2004/11/05 19:16:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200410111
+#define CATALOG_VERSION_NO 200411041
#endif
diff --git a/src/include/catalog/pg_namespace.h b/src/include/catalog/pg_namespace.h
index 795663931b..33c8a59e27 100644
--- a/src/include/catalog/pg_namespace.h
+++ b/src/include/catalog/pg_namespace.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_namespace.h,v 1.14 2004/08/29 05:06:55 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_namespace.h,v 1.15 2004/11/05 19:16:33 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -40,7 +40,6 @@ CATALOG(pg_namespace)
{
NameData nspname;
int4 nspowner;
- Oid nsptablespace; /* default table space for name space */
aclitem nspacl[1]; /* VARIABLE LENGTH FIELD */
} FormData_pg_namespace;
@@ -56,11 +55,10 @@ typedef FormData_pg_namespace *Form_pg_namespace;
* ----------------
*/
-#define Natts_pg_namespace 4
+#define Natts_pg_namespace 3
#define Anum_pg_namespace_nspname 1
#define Anum_pg_namespace_nspowner 2
-#define Anum_pg_namespace_nsptablespace 3
-#define Anum_pg_namespace_nspacl 4
+#define Anum_pg_namespace_nspacl 3
/* ----------------
@@ -68,13 +66,13 @@ typedef FormData_pg_namespace *Form_pg_namespace;
* ---------------
*/
-DATA(insert OID = 11 ( "pg_catalog" PGUID 0 _null_ ));
+DATA(insert OID = 11 ( "pg_catalog" PGUID _null_ ));
DESCR("System catalog schema");
#define PG_CATALOG_NAMESPACE 11
-DATA(insert OID = 99 ( "pg_toast" PGUID 0 _null_ ));
+DATA(insert OID = 99 ( "pg_toast" PGUID _null_ ));
DESCR("Reserved schema for TOAST tables");
#define PG_TOAST_NAMESPACE 99
-DATA(insert OID = 2200 ( "public" PGUID 0 _null_ ));
+DATA(insert OID = 2200 ( "public" PGUID _null_ ));
DESCR("Standard public schema");
#define PG_PUBLIC_NAMESPACE 2200
@@ -82,7 +80,6 @@ DESCR("Standard public schema");
/*
* prototypes for functions in pg_namespace.c
*/
-extern Oid NamespaceCreate(const char *nspName, int32 ownerSysId,
- Oid nspTablespace);
+extern Oid NamespaceCreate(const char *nspName, int32 ownerSysId);
#endif /* PG_NAMESPACE_H */
diff --git a/src/include/commands/tablespace.h b/src/include/commands/tablespace.h
index 58ad23ae16..a6c2188824 100644
--- a/src/include/commands/tablespace.h
+++ b/src/include/commands/tablespace.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.6 2004/10/17 20:47:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.7 2004/11/05 19:16:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,6 +32,7 @@ typedef struct xl_tblspc_drop_rec
Oid ts_id;
} xl_tblspc_drop_rec;
+
extern void CreateTableSpace(CreateTableSpaceStmt *stmt);
extern void DropTableSpace(DropTableSpaceStmt *stmt);
extern void RenameTableSpace(const char *oldname, const char *newname);
@@ -39,6 +40,8 @@ extern void AlterTableSpaceOwner(const char *name, AclId newOwnerSysId);
extern void TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo);
+extern Oid GetDefaultTablespace(void);
+
extern Oid get_tablespace_oid(const char *tablespacename);
extern char *get_tablespace_name(Oid spc_oid);
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 8b46366bd9..9e2dfd839e 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.269 2004/08/29 05:06:57 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.270 2004/11/05 19:16:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -777,7 +777,6 @@ typedef struct CreateSchemaStmt
NodeTag type;
char *schemaname; /* the name of the schema to create */
char *authid; /* the owner of the created schema */
- char *tablespacename; /* default tablespace for schema, or NULL */
List *schemaElts; /* schema components (list of parsenodes) */
} CreateSchemaStmt;
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index 0559264dd1..19ae296559 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -7,7 +7,7 @@
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
- * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.54 2004/10/22 19:48:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.55 2004/11/05 19:16:41 tgl Exp $
*--------------------------------------------------------------------
*/
#ifndef GUC_H
@@ -223,6 +223,10 @@ extern void read_nondefault_variables(void);
/* in utils/adt/datetime.c */
extern bool ClearDateCache(bool newval, bool doit, GucSource source);
+/* in commands/tablespace.c */
+extern const char *assign_default_tablespace(const char *newval,
+ bool doit, GucSource source);
+
/* in utils/adt/regexp.c */
extern const char *assign_regex_flavor(const char *value,
bool doit, GucSource source);
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 3a016b7a52..01f6aa7364 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.91 2004/10/20 16:04:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.92 2004/11/05 19:16:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -72,7 +72,6 @@ extern Oid get_relname_relid(const char *relname, Oid relnamespace);
extern Oid get_system_catalog_relid(const char *catname);
extern char *get_rel_name(Oid relid);
extern Oid get_rel_namespace(Oid relid);
-extern Oid get_rel_tablespace(Oid relid);
extern Oid get_rel_type_id(Oid relid);
extern char get_rel_relkind(Oid relid);
extern bool get_typisdefined(Oid typid);
@@ -116,7 +115,6 @@ extern void free_attstatsslot(Oid atttype,
Datum *values, int nvalues,
float4 *numbers, int nnumbers);
extern char *get_namespace_name(Oid nspid);
-extern Oid get_namespace_tablespace(Oid nspid);
extern int32 get_usesysid(const char *username);
#define is_array_type(typid) (get_element_type(typid) != InvalidOid)