aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-03-26 19:17:02 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-03-26 19:17:02 +0000
commit1dbf8aa7a8159875bb46f6ee6ab0116eee76869b (patch)
tree9aa08b4247dc230b6d35aa9c34b488b36b716693 /src/include
parentda631e931f9da4bc5df4bfd39f0c42684adfb8e5 (diff)
downloadpostgresql-1dbf8aa7a8159875bb46f6ee6ab0116eee76869b.tar.gz
postgresql-1dbf8aa7a8159875bb46f6ee6ab0116eee76869b.zip
pg_class has a relnamespace column. You can create and access tables
in schemas other than the system namespace; however, there's no search path yet, and not all operations work yet on tables outside the system namespace.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/genam.h6
-rw-r--r--src/include/access/heapam.h9
-rw-r--r--src/include/bootstrap/bootstrap.h4
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/catalog/heap.h11
-rw-r--r--src/include/catalog/index.h5
-rw-r--r--src/include/catalog/indexing.h6
-rw-r--r--src/include/catalog/namespace.h26
-rw-r--r--src/include/catalog/pg_attribute.h92
-rw-r--r--src/include/catalog/pg_class.h68
-rw-r--r--src/include/commands/cluster.h4
-rw-r--r--src/include/commands/command.h7
-rw-r--r--src/include/commands/comment.h4
-rw-r--r--src/include/commands/defrem.h10
-rw-r--r--src/include/commands/rename.h4
-rw-r--r--src/include/nodes/parsenodes.h45
-rw-r--r--src/include/nodes/primnodes.h45
-rw-r--r--src/include/utils/catcache.h10
-rw-r--r--src/include/utils/lsyscache.h3
-rw-r--r--src/include/utils/rel.h10
-rw-r--r--src/include/utils/relcache.h8
-rw-r--r--src/include/utils/syscache.h4
22 files changed, 216 insertions, 169 deletions
diff --git a/src/include/access/genam.h b/src/include/access/genam.h
index c8cb4c10586..fe0ab0fba15 100644
--- a/src/include/access/genam.h
+++ b/src/include/access/genam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: genam.h,v 1.32 2002/02/19 20:11:19 tgl Exp $
+ * $Id: genam.h,v 1.33 2002/03/26 19:16:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,6 +17,7 @@
#include "access/itup.h"
#include "access/relscan.h"
#include "access/sdir.h"
+#include "nodes/primnodes.h"
/* Struct for statistics returned by bulk-delete operation */
@@ -50,7 +51,8 @@ typedef SysScanDescData *SysScanDesc;
* generalized index_ interface routines (in indexam.c)
*/
extern Relation index_open(Oid relationId);
-extern Relation index_openr(const char *relationName);
+extern Relation index_openrv(const RangeVar *relation);
+extern Relation index_openr(const char *sysRelationName);
extern void index_close(Relation relation);
extern InsertIndexResult index_insert(Relation relation,
Datum *datum, char *nulls,
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index 9798b5f76a8..c0909584f99 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: heapam.h,v 1.72 2001/11/05 17:46:31 momjian Exp $
+ * $Id: heapam.h,v 1.73 2002/03/26 19:16:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,6 +18,7 @@
#include "access/relscan.h"
#include "access/tupmacs.h"
#include "access/xlogutils.h"
+#include "nodes/primnodes.h"
#include "storage/block.h"
#include "storage/lmgr.h"
#include "utils/rel.h"
@@ -134,11 +135,13 @@ extern Datum heap_getsysattr(HeapTuple tup, int attnum, bool *isnull);
/* heapam.c */
extern Relation relation_open(Oid relationId, LOCKMODE lockmode);
-extern Relation relation_openr(const char *relationName, LOCKMODE lockmode);
+extern Relation relation_openrv(const RangeVar *relation, LOCKMODE lockmode);
+extern Relation relation_openr(const char *sysRelationName, LOCKMODE lockmode);
extern void relation_close(Relation relation, LOCKMODE lockmode);
extern Relation heap_open(Oid relationId, LOCKMODE lockmode);
-extern Relation heap_openr(const char *relationName, LOCKMODE lockmode);
+extern Relation heap_openrv(const RangeVar *relation, LOCKMODE lockmode);
+extern Relation heap_openr(const char *sysRelationName, LOCKMODE lockmode);
#define heap_close(r,l) relation_close(r,l)
diff --git a/src/include/bootstrap/bootstrap.h b/src/include/bootstrap/bootstrap.h
index b80641bd96e..a2e3a0df193 100644
--- a/src/include/bootstrap/bootstrap.h
+++ b/src/include/bootstrap/bootstrap.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: bootstrap.h,v 1.27 2002/03/02 21:39:34 momjian Exp $
+ * $Id: bootstrap.h,v 1.28 2002/03/26 19:16:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,7 +36,7 @@ extern Form_pg_attribute attrtypes[MAXATTR];
extern int numattr;
extern int BootstrapMain(int ac, char *av[]);
-extern void index_register(char *heap, char *ind, IndexInfo *indexInfo);
+extern void index_register(Oid heap, Oid ind, IndexInfo *indexInfo);
extern void err_out(void);
extern void InsertOneTuple(Oid objectid);
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 086df0b2f84..0d9c280fb0d 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: catversion.h,v 1.110 2002/03/22 21:34:44 tgl Exp $
+ * $Id: catversion.h,v 1.111 2002/03/26 19:16:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200203221
+#define CATALOG_VERSION_NO 200203251
#endif
diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h
index b2bcfb71bdc..eb34ee1404f 100644
--- a/src/include/catalog/heap.h
+++ b/src/include/catalog/heap.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: heap.h,v 1.46 2002/03/20 19:44:52 tgl Exp $
+ * $Id: heap.h,v 1.47 2002/03/26 19:16:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,6 +19,7 @@
#include "parser/parse_node.h"
#include "utils/rel.h"
+
typedef struct RawColumnDefault
{
AttrNumber attnum; /* attribute to attach default to */
@@ -26,15 +27,15 @@ typedef struct RawColumnDefault
* tree) */
} RawColumnDefault;
-extern Oid RelnameFindRelid(const char *relname);
-
-extern Relation heap_create(char *relname, TupleDesc tupDesc,
+extern Relation heap_create(char *relname, Oid relnamespace,
+ TupleDesc tupDesc,
bool istemp, bool storage_create,
bool allow_system_table_mods);
extern void heap_storage_create(Relation rel);
-extern Oid heap_create_with_catalog(char *relname, TupleDesc tupdesc,
+extern Oid heap_create_with_catalog(char *relname, Oid relnamespace,
+ TupleDesc tupdesc,
char relkind, bool relhasoids, bool istemp,
bool allow_system_table_mods);
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index c31900a7ccd..86f0824e84a 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: index.h,v 1.45 2002/03/10 06:02:24 momjian Exp $
+ * $Id: index.h,v 1.46 2002/03/26 19:16:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,11 +29,12 @@ typedef void (*IndexBuildCallback) (Relation index,
void *state);
-extern Oid index_create(char *heapRelationName,
+extern Oid index_create(Oid heapRelationId,
char *indexRelationName,
IndexInfo *indexInfo,
Oid accessMethodObjectId,
Oid *classObjectId,
+ bool istemp,
bool primary,
bool allow_system_table_mods);
diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h
index c6291f2a3a4..222e0da51e9 100644
--- a/src/include/catalog/indexing.h
+++ b/src/include/catalog/indexing.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: indexing.h,v 1.58 2002/03/22 21:34:44 tgl Exp $
+ * $Id: indexing.h,v 1.59 2002/03/26 19:16:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,7 +58,7 @@
#define AttrDefaultIndex "pg_attrdef_adrelid_adnum_index"
#define AttributeRelidNameIndex "pg_attribute_relid_attnam_index"
#define AttributeRelidNumIndex "pg_attribute_relid_attnum_index"
-#define ClassNameIndex "pg_class_relname_index"
+#define ClassNameNspIndex "pg_class_relname_nsp_index"
#define ClassOidIndex "pg_class_oid_index"
#define DatabaseNameIndex "pg_database_datname_index"
#define DatabaseOidIndex "pg_database_oid_index"
@@ -156,7 +156,7 @@ DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index on pg_attrdef using btree(ad
DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index on pg_attribute using btree(attrelid oid_ops, attname name_ops));
DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnum_index on pg_attribute using btree(attrelid oid_ops, attnum int2_ops));
DECLARE_UNIQUE_INDEX(pg_class_oid_index on pg_class using btree(oid oid_ops));
-DECLARE_UNIQUE_INDEX(pg_class_relname_index on pg_class using btree(relname name_ops));
+DECLARE_UNIQUE_INDEX(pg_class_relname_nsp_index on pg_class using btree(relname name_ops, relnamespace oid_ops));
DECLARE_UNIQUE_INDEX(pg_database_datname_index on pg_database using btree(datname name_ops));
DECLARE_UNIQUE_INDEX(pg_database_oid_index on pg_database using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_description_o_c_o_index on pg_description using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops));
diff --git a/src/include/catalog/namespace.h b/src/include/catalog/namespace.h
new file mode 100644
index 00000000000..cbe65a07f55
--- /dev/null
+++ b/src/include/catalog/namespace.h
@@ -0,0 +1,26 @@
+/*-------------------------------------------------------------------------
+ *
+ * namespace.h
+ * prototypes for functions in backend/catalog/namespace.c
+ *
+ *
+ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * $Id: namespace.h,v 1.1 2002/03/26 19:16:28 tgl Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef NAMESPACE_H
+#define NAMESPACE_H
+
+#include "nodes/primnodes.h"
+
+
+extern Oid RangeVarGetRelid(const RangeVar *relation, bool failOK);
+
+extern Oid RangeVarGetCreationNamespace(const RangeVar *newRelation);
+
+extern Oid RelnameGetRelid(const char *relname);
+
+#endif /* NAMESPACE_H */
diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h
index df7cec83974..e8166960d28 100644
--- a/src/include/catalog/pg_attribute.h
+++ b/src/include/catalog/pg_attribute.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_attribute.h,v 1.85 2002/03/20 19:44:55 tgl Exp $
+ * $Id: pg_attribute.h,v 1.86 2002/03/26 19:16:29 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -437,52 +437,54 @@ DATA(insert ( 1249 tableoid 26 0 4 -7 0 -1 -1 t p f i f f));
*/
#define Schema_pg_class \
{ 1259, {"relname"}, 19, DEFAULT_ATTSTATTARGET, NAMEDATALEN, 1, 0, -1, -1, false, 'p', false, 'i', false, false }, \
-{ 1259, {"reltype"}, 26, 0, 4, 2, 0, -1, -1, true, 'p', false, 'i', false, false }, \
-{ 1259, {"relowner"}, 23, 0, 4, 3, 0, -1, -1, true, 'p', false, 'i', false, false }, \
-{ 1259, {"relam"}, 26, 0, 4, 4, 0, -1, -1, true, 'p', false, 'i', false, false }, \
-{ 1259, {"relfilenode"}, 26, 0, 4, 5, 0, -1, -1, true, 'p', false, 'i', false, false }, \
-{ 1259, {"relpages"}, 23, 0, 4, 6, 0, -1, -1, true, 'p', false, 'i', false, false }, \
-{ 1259, {"reltuples"}, 700, 0, 4, 7, 0, -1, -1, false, 'p', false, 'i', false, false }, \
-{ 1259, {"reltoastrelid"}, 26, 0, 4, 8, 0, -1, -1, true, 'p', false, 'i', false, false }, \
-{ 1259, {"reltoastidxid"}, 26, 0, 4, 9, 0, -1, -1, true, 'p', false, 'i', false, false }, \
-{ 1259, {"relhasindex"}, 16, 0, 1, 10, 0, -1, -1, true, 'p', false, 'c', false, false }, \
-{ 1259, {"relisshared"}, 16, 0, 1, 11, 0, -1, -1, true, 'p', false, 'c', false, false }, \
-{ 1259, {"relkind"}, 18, 0, 1, 12, 0, -1, -1, true, 'p', false, 'c', false, false }, \
-{ 1259, {"relnatts"}, 21, 0, 2, 13, 0, -1, -1, true, 'p', false, 's', false, false }, \
-{ 1259, {"relchecks"}, 21, 0, 2, 14, 0, -1, -1, true, 'p', false, 's', false, false }, \
-{ 1259, {"reltriggers"}, 21, 0, 2, 15, 0, -1, -1, true, 'p', false, 's', false, false }, \
-{ 1259, {"relukeys"}, 21, 0, 2, 16, 0, -1, -1, true, 'p', false, 's', false, false }, \
-{ 1259, {"relfkeys"}, 21, 0, 2, 17, 0, -1, -1, true, 'p', false, 's', false, false }, \
-{ 1259, {"relrefs"}, 21, 0, 2, 18, 0, -1, -1, true, 'p', false, 's', false, false }, \
-{ 1259, {"relhasoids"}, 16, 0, 1, 19, 0, -1, -1, true, 'p', false, 'c', false, false }, \
-{ 1259, {"relhaspkey"}, 16, 0, 1, 20, 0, -1, -1, true, 'p', false, 'c', false, false }, \
-{ 1259, {"relhasrules"}, 16, 0, 1, 21, 0, -1, -1, true, 'p', false, 'c', false, false }, \
-{ 1259, {"relhassubclass"},16, 0, 1, 22, 0, -1, -1, true, 'p', false, 'c', false, false }, \
-{ 1259, {"relacl"}, 1034, 0, -1, 23, 0, -1, -1, false, 'x', false, 'i', false, false }
+{ 1259, {"relnamespace"}, 26, 0, 4, 2, 0, -1, -1, true, 'p', false, 'i', false, false }, \
+{ 1259, {"reltype"}, 26, 0, 4, 3, 0, -1, -1, true, 'p', false, 'i', false, false }, \
+{ 1259, {"relowner"}, 23, 0, 4, 4, 0, -1, -1, true, 'p', false, 'i', false, false }, \
+{ 1259, {"relam"}, 26, 0, 4, 5, 0, -1, -1, true, 'p', false, 'i', false, false }, \
+{ 1259, {"relfilenode"}, 26, 0, 4, 6, 0, -1, -1, true, 'p', false, 'i', false, false }, \
+{ 1259, {"relpages"}, 23, 0, 4, 7, 0, -1, -1, true, 'p', false, 'i', false, false }, \
+{ 1259, {"reltuples"}, 700, 0, 4, 8, 0, -1, -1, false, 'p', false, 'i', false, false }, \
+{ 1259, {"reltoastrelid"}, 26, 0, 4, 9, 0, -1, -1, true, 'p', false, 'i', false, false }, \
+{ 1259, {"reltoastidxid"}, 26, 0, 4, 10, 0, -1, -1, true, 'p', false, 'i', false, false }, \
+{ 1259, {"relhasindex"}, 16, 0, 1, 11, 0, -1, -1, true, 'p', false, 'c', false, false }, \
+{ 1259, {"relisshared"}, 16, 0, 1, 12, 0, -1, -1, true, 'p', false, 'c', false, false }, \
+{ 1259, {"relkind"}, 18, 0, 1, 13, 0, -1, -1, true, 'p', false, 'c', false, false }, \
+{ 1259, {"relnatts"}, 21, 0, 2, 14, 0, -1, -1, true, 'p', false, 's', false, false }, \
+{ 1259, {"relchecks"}, 21, 0, 2, 15, 0, -1, -1, true, 'p', false, 's', false, false }, \
+{ 1259, {"reltriggers"}, 21, 0, 2, 16, 0, -1, -1, true, 'p', false, 's', false, false }, \
+{ 1259, {"relukeys"}, 21, 0, 2, 17, 0, -1, -1, true, 'p', false, 's', false, false }, \
+{ 1259, {"relfkeys"}, 21, 0, 2, 18, 0, -1, -1, true, 'p', false, 's', false, false }, \
+{ 1259, {"relrefs"}, 21, 0, 2, 19, 0, -1, -1, true, 'p', false, 's', false, false }, \
+{ 1259, {"relhasoids"}, 16, 0, 1, 20, 0, -1, -1, true, 'p', false, 'c', false, false }, \
+{ 1259, {"relhaspkey"}, 16, 0, 1, 21, 0, -1, -1, true, 'p', false, 'c', false, false }, \
+{ 1259, {"relhasrules"}, 16, 0, 1, 22, 0, -1, -1, true, 'p', false, 'c', false, false }, \
+{ 1259, {"relhassubclass"},16, 0, 1, 23, 0, -1, -1, true, 'p', false, 'c', false, false }, \
+{ 1259, {"relacl"}, 1034, 0, -1, 24, 0, -1, -1, false, 'x', false, 'i', false, false }
DATA(insert ( 1259 relname 19 DEFAULT_ATTSTATTARGET NAMEDATALEN 1 0 -1 -1 f p f i f f));
-DATA(insert ( 1259 reltype 26 0 4 2 0 -1 -1 t p f i f f));
-DATA(insert ( 1259 relowner 23 0 4 3 0 -1 -1 t p f i f f));
-DATA(insert ( 1259 relam 26 0 4 4 0 -1 -1 t p f i f f));
-DATA(insert ( 1259 relfilenode 26 0 4 5 0 -1 -1 t p f i f f));
-DATA(insert ( 1259 relpages 23 0 4 6 0 -1 -1 t p f i f f));
-DATA(insert ( 1259 reltuples 700 0 4 7 0 -1 -1 f p f i f f));
-DATA(insert ( 1259 reltoastrelid 26 0 4 8 0 -1 -1 t p f i f f));
-DATA(insert ( 1259 reltoastidxid 26 0 4 9 0 -1 -1 t p f i f f));
-DATA(insert ( 1259 relhasindex 16 0 1 10 0 -1 -1 t p f c f f));
-DATA(insert ( 1259 relisshared 16 0 1 11 0 -1 -1 t p f c f f));
-DATA(insert ( 1259 relkind 18 0 1 12 0 -1 -1 t p f c f f));
-DATA(insert ( 1259 relnatts 21 0 2 13 0 -1 -1 t p f s f f));
-DATA(insert ( 1259 relchecks 21 0 2 14 0 -1 -1 t p f s f f));
-DATA(insert ( 1259 reltriggers 21 0 2 15 0 -1 -1 t p f s f f));
-DATA(insert ( 1259 relukeys 21 0 2 16 0 -1 -1 t p f s f f));
-DATA(insert ( 1259 relfkeys 21 0 2 17 0 -1 -1 t p f s f f));
-DATA(insert ( 1259 relrefs 21 0 2 18 0 -1 -1 t p f s f f));
-DATA(insert ( 1259 relhasoids 16 0 1 19 0 -1 -1 t p f c f f));
-DATA(insert ( 1259 relhaspkey 16 0 1 20 0 -1 -1 t p f c f f));
-DATA(insert ( 1259 relhasrules 16 0 1 21 0 -1 -1 t p f c f f));
-DATA(insert ( 1259 relhassubclass 16 0 1 22 0 -1 -1 t p f c f f));
-DATA(insert ( 1259 relacl 1034 0 -1 23 0 -1 -1 f x f i f f));
+DATA(insert ( 1259 relnamespace 26 0 4 2 0 -1 -1 t p f i f f));
+DATA(insert ( 1259 reltype 26 0 4 3 0 -1 -1 t p f i f f));
+DATA(insert ( 1259 relowner 23 0 4 4 0 -1 -1 t p f i f f));
+DATA(insert ( 1259 relam 26 0 4 5 0 -1 -1 t p f i f f));
+DATA(insert ( 1259 relfilenode 26 0 4 6 0 -1 -1 t p f i f f));
+DATA(insert ( 1259 relpages 23 0 4 7 0 -1 -1 t p f i f f));
+DATA(insert ( 1259 reltuples 700 0 4 8 0 -1 -1 f p f i f f));
+DATA(insert ( 1259 reltoastrelid 26 0 4 9 0 -1 -1 t p f i f f));
+DATA(insert ( 1259 reltoastidxid 26 0 4 10 0 -1 -1 t p f i f f));
+DATA(insert ( 1259 relhasindex 16 0 1 11 0 -1 -1 t p f c f f));
+DATA(insert ( 1259 relisshared 16 0 1 12 0 -1 -1 t p f c f f));
+DATA(insert ( 1259 relkind 18 0 1 13 0 -1 -1 t p f c f f));
+DATA(insert ( 1259 relnatts 21 0 2 14 0 -1 -1 t p f s f f));
+DATA(insert ( 1259 relchecks 21 0 2 15 0 -1 -1 t p f s f f));
+DATA(insert ( 1259 reltriggers 21 0 2 16 0 -1 -1 t p f s f f));
+DATA(insert ( 1259 relukeys 21 0 2 17 0 -1 -1 t p f s f f));
+DATA(insert ( 1259 relfkeys 21 0 2 18 0 -1 -1 t p f s f f));
+DATA(insert ( 1259 relrefs 21 0 2 19 0 -1 -1 t p f s f f));
+DATA(insert ( 1259 relhasoids 16 0 1 20 0 -1 -1 t p f c f f));
+DATA(insert ( 1259 relhaspkey 16 0 1 21 0 -1 -1 t p f c f f));
+DATA(insert ( 1259 relhasrules 16 0 1 22 0 -1 -1 t p f c f f));
+DATA(insert ( 1259 relhassubclass 16 0 1 23 0 -1 -1 t p f c f f));
+DATA(insert ( 1259 relacl 1034 0 -1 24 0 -1 -1 f x f i f f));
DATA(insert ( 1259 ctid 27 0 6 -1 0 -1 -1 f p f i f f));
DATA(insert ( 1259 oid 26 0 4 -2 0 -1 -1 t p f i f f));
DATA(insert ( 1259 xmin 28 0 4 -3 0 -1 -1 t p f i f f));
diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h
index ccfc0ceef91..60f524b2a62 100644
--- a/src/include/catalog/pg_class.h
+++ b/src/include/catalog/pg_class.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_class.h,v 1.62 2002/03/19 02:18:22 momjian Exp $
+ * $Id: pg_class.h,v 1.63 2002/03/26 19:16:35 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -43,6 +43,7 @@
CATALOG(pg_class) BOOTSTRAP
{
NameData relname; /* class name */
+ Oid relnamespace; /* OID of namespace containing this class */
Oid reltype; /* OID of associated entry in pg_type */
int4 relowner; /* class owner */
Oid relam; /* index access method; 0 if not an index */
@@ -99,31 +100,32 @@ typedef FormData_pg_class *Form_pg_class;
* relacl field. This is a kluge.
* ----------------
*/
-#define Natts_pg_class_fixed 22
-#define Natts_pg_class 23
+#define Natts_pg_class_fixed 23
+#define Natts_pg_class 24
#define Anum_pg_class_relname 1
-#define Anum_pg_class_reltype 2
-#define Anum_pg_class_relowner 3
-#define Anum_pg_class_relam 4
-#define Anum_pg_class_relfilenode 5
-#define Anum_pg_class_relpages 6
-#define Anum_pg_class_reltuples 7
-#define Anum_pg_class_reltoastrelid 8
-#define Anum_pg_class_reltoastidxid 9
-#define Anum_pg_class_relhasindex 10
-#define Anum_pg_class_relisshared 11
-#define Anum_pg_class_relkind 12
-#define Anum_pg_class_relnatts 13
-#define Anum_pg_class_relchecks 14
-#define Anum_pg_class_reltriggers 15
-#define Anum_pg_class_relukeys 16
-#define Anum_pg_class_relfkeys 17
-#define Anum_pg_class_relrefs 18
-#define Anum_pg_class_relhasoids 19
-#define Anum_pg_class_relhaspkey 20
-#define Anum_pg_class_relhasrules 21
-#define Anum_pg_class_relhassubclass 22
-#define Anum_pg_class_relacl 23
+#define Anum_pg_class_relnamespace 2
+#define Anum_pg_class_reltype 3
+#define Anum_pg_class_relowner 4
+#define Anum_pg_class_relam 5
+#define Anum_pg_class_relfilenode 6
+#define Anum_pg_class_relpages 7
+#define Anum_pg_class_reltuples 8
+#define Anum_pg_class_reltoastrelid 9
+#define Anum_pg_class_reltoastidxid 10
+#define Anum_pg_class_relhasindex 11
+#define Anum_pg_class_relisshared 12
+#define Anum_pg_class_relkind 13
+#define Anum_pg_class_relnatts 14
+#define Anum_pg_class_relchecks 15
+#define Anum_pg_class_reltriggers 16
+#define Anum_pg_class_relukeys 17
+#define Anum_pg_class_relfkeys 18
+#define Anum_pg_class_relrefs 19
+#define Anum_pg_class_relhasoids 20
+#define Anum_pg_class_relhaspkey 21
+#define Anum_pg_class_relhasrules 22
+#define Anum_pg_class_relhassubclass 23
+#define Anum_pg_class_relacl 24
/* ----------------
* initial contents of pg_class
@@ -132,21 +134,21 @@ typedef FormData_pg_class *Form_pg_class;
* ----------------
*/
-DATA(insert OID = 1247 ( pg_type 71 PGUID 0 1247 0 0 0 0 f f r 22 0 0 0 0 0 t f f f _null_ ));
+DATA(insert OID = 1247 ( pg_type PGNSP 71 PGUID 0 1247 0 0 0 0 f f r 22 0 0 0 0 0 t f f f _null_ ));
DESCR("");
-DATA(insert OID = 1249 ( pg_attribute 75 PGUID 0 1249 0 0 0 0 f f r 15 0 0 0 0 0 f f f f _null_ ));
+DATA(insert OID = 1249 ( pg_attribute PGNSP 75 PGUID 0 1249 0 0 0 0 f f r 15 0 0 0 0 0 f f f f _null_ ));
DESCR("");
-DATA(insert OID = 1255 ( pg_proc 81 PGUID 0 1255 0 0 0 0 f f r 18 0 0 0 0 0 t f f f _null_ ));
+DATA(insert OID = 1255 ( pg_proc PGNSP 81 PGUID 0 1255 0 0 0 0 f f r 18 0 0 0 0 0 t f f f _null_ ));
DESCR("");
-DATA(insert OID = 1259 ( pg_class 83 PGUID 0 1259 0 0 0 0 f f r 23 0 0 0 0 0 t f f f _null_ ));
+DATA(insert OID = 1259 ( pg_class PGNSP 83 PGUID 0 1259 0 0 0 0 f f r 24 0 0 0 0 0 t f f f _null_ ));
DESCR("");
-DATA(insert OID = 1260 ( pg_shadow 86 PGUID 0 1260 0 0 0 0 f t r 9 0 0 0 0 0 f f f f _null_ ));
+DATA(insert OID = 1260 ( pg_shadow PGNSP 86 PGUID 0 1260 0 0 0 0 f t r 9 0 0 0 0 0 f f f f _null_ ));
DESCR("");
-DATA(insert OID = 1261 ( pg_group 87 PGUID 0 1261 0 0 0 0 f t r 3 0 0 0 0 0 f f f f _null_ ));
+DATA(insert OID = 1261 ( pg_group PGNSP 87 PGUID 0 1261 0 0 0 0 f t r 3 0 0 0 0 0 f f f f _null_ ));
DESCR("");
-DATA(insert OID = 1262 ( pg_database 88 PGUID 0 1262 0 0 0 0 f t r 10 0 0 0 0 0 t f f f _null_ ));
+DATA(insert OID = 1262 ( pg_database PGNSP 88 PGUID 0 1262 0 0 0 0 f t r 10 0 0 0 0 0 t f f f _null_ ));
DESCR("");
-DATA(insert OID = 376 ( pg_xactlock 0 PGUID 0 0 0 0 0 0 f t s 1 0 0 0 0 0 f f f f _null_ ));
+DATA(insert OID = 376 ( pg_xactlock PGNSP 0 PGUID 0 0 0 0 0 0 f t s 1 0 0 0 0 0 f f f f _null_ ));
DESCR("");
#define RelOid_pg_type 1247
diff --git a/src/include/commands/cluster.h b/src/include/commands/cluster.h
index d0760070841..c04cca24b42 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/cluster.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
- * $Id: cluster.h,v 1.12 2001/11/05 17:46:33 momjian Exp $
+ * $Id: cluster.h,v 1.13 2002/03/26 19:16:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,6 @@
/*
* functions
*/
-extern void cluster(char *oldrelname, char *oldindexname);
+extern void cluster(RangeVar *oldrelation, char *oldindexname);
#endif /* CLUSTER_H */
diff --git a/src/include/commands/command.h b/src/include/commands/command.h
index 36757b1f702..1601898b405 100644
--- a/src/include/commands/command.h
+++ b/src/include/commands/command.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: command.h,v 1.34 2002/03/21 16:01:41 tgl Exp $
+ * $Id: command.h,v 1.35 2002/03/26 19:16:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -62,10 +62,9 @@ extern void AlterTableDropConstraint(const char *relationName,
bool inh, const char *constrName,
int behavior);
-extern void AlterTableCreateToastTable(const char *relationName,
- bool silent);
+extern void AlterTableCreateToastTable(Oid relOid, bool silent);
-extern void AlterTableOwner(const char *relationName, const char *newOwnerName);
+extern void AlterTableOwner(const RangeVar *tgtrel, const char *newOwnerName);
/*
* LOCK
diff --git a/src/include/commands/comment.h b/src/include/commands/comment.h
index 4d83372bdd6..f1e9a760b0b 100644
--- a/src/include/commands/comment.h
+++ b/src/include/commands/comment.h
@@ -25,8 +25,8 @@
*------------------------------------------------------------------
*/
-extern void CommentObject(int objtype, char *objname, char *objproperty,
- List *objlist, char *comment);
+extern void CommentObject(int objtype, char * schemaname, char *objname,
+ char *objproperty, List *objlist, char *comment);
extern void DeleteComments(Oid oid, Oid classoid);
diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h
index 78b34614d58..97924979c28 100644
--- a/src/include/commands/defrem.h
+++ b/src/include/commands/defrem.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: defrem.h,v 1.31 2002/03/19 02:18:23 momjian Exp $
+ * $Id: defrem.h,v 1.32 2002/03/26 19:16:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,7 +19,7 @@
/*
* prototypes in indexcmds.c
*/
-extern void DefineIndex(char *heapRelationName,
+extern void DefineIndex(RangeVar *heapRelation,
char *indexRelationName,
char *accessMethodName,
List *attributeList,
@@ -27,9 +27,9 @@ extern void DefineIndex(char *heapRelationName,
bool primary,
Expr *predicate,
List *rangetable);
-extern void RemoveIndex(char *name);
-extern void ReindexIndex(const char *indexRelationName, bool force);
-extern void ReindexTable(const char *relationName, bool force);
+extern void RemoveIndex(RangeVar *relation);
+extern void ReindexIndex(RangeVar *indexRelation, bool force);
+extern void ReindexTable(RangeVar *relation, bool force);
extern void ReindexDatabase(const char *databaseName, bool force, bool all);
/*
diff --git a/src/include/commands/rename.h b/src/include/commands/rename.h
index 76b5167a83b..7bfd0479167 100644
--- a/src/include/commands/rename.h
+++ b/src/include/commands/rename.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: rename.h,v 1.13 2001/11/05 17:46:33 momjian Exp $
+ * $Id: rename.h,v 1.14 2002/03/26 19:16:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,7 +19,7 @@ extern void renameatt(char *relname,
char *newattname,
int recurse);
-extern void renamerel(const char *oldrelname,
+extern void renamerel(const RangeVar *relation,
const char *newrelname);
#endif /* RENAME_H */
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 883130f90a0..e66e7b8b646 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parsenodes.h,v 1.164 2002/03/22 02:56:36 tgl Exp $
+ * $Id: parsenodes.h,v 1.165 2002/03/26 19:16:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,14 +17,6 @@
#include "nodes/primnodes.h"
-typedef enum InhOption
-{
- INH_NO, /* Do NOT scan child tables */
- INH_YES, /* DO scan child tables */
- INH_DEFAULT /* Use current SQL_inheritance option */
-} InhOption;
-
-
/*****************************************************************************
* Query Tree
*****************************************************************************/
@@ -49,7 +41,7 @@ typedef struct Query
* statement */
int resultRelation; /* target relation (index into rtable) */
- struct RangeVar *into; /* target relation or portal (cursor)
+ RangeVar *into; /* target relation or portal (cursor)
* for portal just name is meaningful */
bool isPortal; /* is this a retrieve into portal? */
bool isBinary; /* binary portal? */
@@ -369,39 +361,6 @@ typedef struct SortGroupBy
} SortGroupBy;
/*
- * Alias -
- * specifies an alias for a range variable; the alias might also
- * specify renaming of columns within the table.
- */
-typedef struct Alias
-{
- NodeTag type;
- char *aliasname; /* aliased rel name (never qualified) */
- List *colnames; /* optional list of column aliases */
- /* Note: colnames is a list of Value nodes (always strings) */
-} Alias;
-
-/*
- * RangeVar - range variable, used in FROM clauses
- *
- * Also used to represent table names in utility statements; there, the alias
- * field is not used, and inhOpt shows whether to apply the operation
- * recursively to child tables. In some contexts it is also useful to carry
- * a TEMP table indication here.
- */
-typedef struct RangeVar
-{
- NodeTag type;
- char *catalogname; /* the catalog (database) name, or NULL */
- char *schemaname; /* the schema name, or NULL */
- char *relname; /* the relation/sequence name */
- InhOption inhOpt; /* expand rel by inheritance?
- * recursively act on children? */
- bool istemp; /* is this a temp relation/sequence? */
- Alias *alias; /* table alias & optional column aliases */
-} RangeVar;
-
-/*
* RangeSubselect - subquery appearing in a FROM clause
*/
typedef struct RangeSubselect
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index f7323058251..dc01689e30e 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: primnodes.h,v 1.59 2002/03/21 16:01:48 tgl Exp $
+ * $Id: primnodes.h,v 1.60 2002/03/26 19:16:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -93,6 +93,47 @@ typedef struct Fjoin
} Fjoin;
+/*
+ * Alias -
+ * specifies an alias for a range variable; the alias might also
+ * specify renaming of columns within the table.
+ */
+typedef struct Alias
+{
+ NodeTag type;
+ char *aliasname; /* aliased rel name (never qualified) */
+ List *colnames; /* optional list of column aliases */
+ /* Note: colnames is a list of Value nodes (always strings) */
+} Alias;
+
+typedef enum InhOption
+{
+ INH_NO, /* Do NOT scan child tables */
+ INH_YES, /* DO scan child tables */
+ INH_DEFAULT /* Use current SQL_inheritance option */
+} InhOption;
+
+/*
+ * RangeVar - range variable, used in FROM clauses
+ *
+ * Also used to represent table names in utility statements; there, the alias
+ * field is not used, and inhOpt shows whether to apply the operation
+ * recursively to child tables. In some contexts it is also useful to carry
+ * a TEMP table indication here.
+ */
+typedef struct RangeVar
+{
+ NodeTag type;
+ char *catalogname; /* the catalog (database) name, or NULL */
+ char *schemaname; /* the schema name, or NULL */
+ char *relname; /* the relation/sequence name */
+ InhOption inhOpt; /* expand rel by inheritance?
+ * recursively act on children? */
+ bool istemp; /* is this a temp relation/sequence? */
+ Alias *alias; /* table alias & optional column aliases */
+} RangeVar;
+
+
/* ----------------------------------------------------------------
* node types for executable expressions
* ----------------------------------------------------------------
@@ -527,7 +568,7 @@ typedef struct JoinExpr
Node *rarg; /* right subtree */
List *using; /* USING clause, if any (list of String) */
Node *quals; /* qualifiers on join, if any */
- struct Alias *alias; /* user-written alias clause, if any */
+ Alias *alias; /* user-written alias clause, if any */
int rtindex; /* RT index assigned for join */
} JoinExpr;
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index 034c061e7d4..8e98f41c019 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: catcache.h,v 1.40 2002/03/06 20:49:46 momjian Exp $
+ * $Id: catcache.h,v 1.41 2002/03/26 19:16:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,8 +33,8 @@ typedef struct catcache
{
int id; /* cache identifier --- see syscache.h */
struct catcache *cc_next; /* link to next catcache */
- char *cc_relname; /* name of relation the tuples come from */
- char *cc_indname; /* name of index matching cache keys */
+ const char *cc_relname; /* name of relation the tuples come from */
+ const char *cc_indname; /* name of index matching cache keys */
Oid cc_reloid; /* OID of relation the tuples come from */
bool cc_relisshared; /* is relation shared? */
TupleDesc cc_tupdesc; /* tuple descriptor (copied from reldesc) */
@@ -107,9 +107,9 @@ extern MemoryContext CacheMemoryContext;
extern void CreateCacheMemoryContext(void);
extern void AtEOXact_CatCache(bool isCommit);
-extern CatCache *InitCatCache(int id, char *relname, char *indname,
+extern CatCache *InitCatCache(int id, const char *relname, const char *indname,
int reloidattr,
- int nkeys, int *key);
+ int nkeys, const int *key);
extern void InitCatCachePhase2(CatCache *cache);
extern HeapTuple SearchCatCache(CatCache *cache,
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 89dda37bf7c..a18ed521074 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: lsyscache.h,v 1.45 2002/03/22 02:56:37 tgl Exp $
+ * $Id: lsyscache.h,v 1.46 2002/03/26 19:16:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,6 +39,7 @@ extern RegProcedure get_oprrest(Oid opno);
extern RegProcedure get_oprjoin(Oid opno);
extern Oid get_func_rettype(Oid funcid);
extern bool func_iscachable(Oid funcid);
+extern Oid get_relname_relid(const char *relname, Oid relnamespace);
extern char *get_rel_name(Oid relid);
extern Oid get_rel_type_id(Oid relid);
extern int16 get_typlen(Oid typid);
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 49814386ca6..16398b4c08f 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: rel.h,v 1.56 2002/02/19 20:11:19 tgl Exp $
+ * $Id: rel.h,v 1.57 2002/03/26 19:16:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -282,6 +282,14 @@ typedef Relation *RelationPtr;
RelationGetPhysicalRelationName(relation) \
)
+/*
+ * RelationGetNamespace
+ *
+ * Returns the rel's namespace OID.
+ */
+#define RelationGetNamespace(relation) \
+ ((relation)->rd_rel->relnamespace)
+
/* added to prevent circular dependency. bjm 1999/11/15 */
extern char *get_temp_rel_by_physicalname(const char *relname);
diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h
index e5af1bee61b..6e6164b87c8 100644
--- a/src/include/utils/relcache.h
+++ b/src/include/utils/relcache.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: relcache.h,v 1.30 2002/02/19 20:11:20 tgl Exp $
+ * $Id: relcache.h,v 1.31 2002/03/26 19:16:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,11 +20,11 @@
* relation lookup routines
*/
extern Relation RelationIdGetRelation(Oid relationId);
-extern Relation RelationNameGetRelation(const char *relationName);
-extern Relation RelationNodeCacheGetRelation(RelFileNode rnode);
+extern Relation RelationSysNameGetRelation(const char *relationName);
/* finds an existing cache entry, but won't make a new one */
extern Relation RelationIdCacheGetRelation(Oid relationId);
+extern Relation RelationNodeCacheGetRelation(RelFileNode rnode);
extern void RelationClose(Relation relation);
@@ -46,8 +46,10 @@ extern void RelationCacheInitializePhase3(void);
* Routine to create a relcache entry for an about-to-be-created relation
*/
extern Relation RelationBuildLocalRelation(const char *relname,
+ Oid relnamespace,
TupleDesc tupDesc,
Oid relid, Oid dbid,
+ RelFileNode rnode,
bool nailit);
/*
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index 45de795c9c8..49af9690758 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: syscache.h,v 1.39 2002/03/22 21:34:44 tgl Exp $
+ * $Id: syscache.h,v 1.40 2002/03/26 19:16:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,7 +51,7 @@
#define OPEROID 20
#define PROCNAME 21
#define PROCOID 22
-#define RELNAME 23
+#define RELNAMENSP 23
#define RELOID 24
#define RULENAME 25
#define SHADOWNAME 26