Create the pg_namespace system catalog. Doesn't do much yet, but it's

there and CREATE SCHEMA will make entries in it...
This commit is contained in:
Tom Lane
2002-03-22 21:34:44 +00:00
parent 48c9164901
commit a25b94c080
13 changed files with 285 additions and 35 deletions

View File

@ -1,13 +1,13 @@
/*-------------------------------------------------------------------------
*
* catalog.h
* prototypes for functions in lib/catalog/catalog.c
* prototypes for functions in backend/catalog/catalog.c
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: catalog.h,v 1.21 2001/11/16 23:30:35 tgl Exp $
* $Id: catalog.h,v 1.22 2002/03/22 21:34:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: catname.h,v 1.23 2001/11/05 17:46:31 momjian Exp $
* $Id: catname.h,v 1.24 2002/03/22 21:34:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -15,7 +15,6 @@
#define CATNAME_H
#define AggregateRelationName "pg_aggregate"
#define AccessMethodRelationName "pg_am"
#define AccessMethodOperatorRelationName "pg_amop"
@ -29,6 +28,7 @@
#define LanguageRelationName "pg_language"
#define LargeObjectRelationName "pg_largeobject"
#define ListenerRelationName "pg_listener"
#define NamespaceRelationName "pg_namespace"
#define OperatorClassRelationName "pg_opclass"
#define OperatorRelationName "pg_operator"
#define ProcedureRelationName "pg_proc"

View File

@ -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.109 2002/03/22 02:56:35 tgl Exp $
* $Id: catversion.h,v 1.110 2002/03/22 21:34:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 200203212
#define CATALOG_VERSION_NO 200203221
#endif

View File

@ -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.57 2002/02/19 20:11:19 tgl Exp $
* $Id: indexing.h,v 1.58 2002/03/22 21:34:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -34,6 +34,7 @@
#define Num_pg_inherits_indices 1
#define Num_pg_language_indices 2
#define Num_pg_largeobject_indices 1
#define Num_pg_namespace_indices 2
#define Num_pg_opclass_indices 2
#define Num_pg_operator_indices 2
#define Num_pg_proc_indices 2
@ -70,6 +71,8 @@
#define LanguageNameIndex "pg_language_name_index"
#define LanguageOidIndex "pg_language_oid_index"
#define LargeObjectLOidPNIndex "pg_largeobject_loid_pn_index"
#define NamespaceNameIndex "pg_namespace_nspname_index"
#define NamespaceOidIndex "pg_namespace_oid_index"
#define OpclassAmNameIndex "pg_opclass_am_name_index"
#define OpclassOidIndex "pg_opclass_oid_index"
#define OperatorNameIndex "pg_operator_oprname_l_r_k_index"
@ -104,6 +107,7 @@ extern char *Name_pg_index_indices[];
extern char *Name_pg_inherits_indices[];
extern char *Name_pg_language_indices[];
extern char *Name_pg_largeobject_indices[];
extern char *Name_pg_namespace_indices[];
extern char *Name_pg_opclass_indices[];
extern char *Name_pg_operator_indices[];
extern char *Name_pg_proc_indices[];
@ -165,6 +169,8 @@ DECLARE_UNIQUE_INDEX(pg_inherits_relid_seqno_index on pg_inherits using btree(in
DECLARE_UNIQUE_INDEX(pg_language_name_index on pg_language using btree(lanname name_ops));
DECLARE_UNIQUE_INDEX(pg_language_oid_index on pg_language using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_largeobject_loid_pn_index on pg_largeobject using btree(loid oid_ops, pageno int4_ops));
DECLARE_UNIQUE_INDEX(pg_namespace_nspname_index on pg_namespace using btree(nspname name_ops));
DECLARE_UNIQUE_INDEX(pg_namespace_oid_index on pg_namespace using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_opclass_am_name_index on pg_opclass using btree(opcamid oid_ops, opcname name_ops));
DECLARE_UNIQUE_INDEX(pg_opclass_oid_index on pg_opclass using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_operator_oid_index on pg_operator using btree(oid oid_ops));

View File

@ -0,0 +1,79 @@
/*-------------------------------------------------------------------------
*
* pg_namespace.h
* definition of the system "namespace" relation (pg_namespace)
* along with the relation's initial contents.
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_namespace.h,v 1.1 2002/03/22 21:34:44 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* information from the DATA() statements.
*
*-------------------------------------------------------------------------
*/
#ifndef PG_NAMESPACE_H
#define PG_NAMESPACE_H
/* ----------------
* postgres.h contains the system type definitions and the
* CATALOG(), BOOTSTRAP and DATA() sugar words so this file
* can be read by both genbki.sh and the C compiler.
* ----------------
*/
/* ----------------------------------------------------------------
* pg_namespace definition.
*
* cpp turns this into typedef struct FormData_pg_namespace
*
* nspname name of the namespace
* nspowner owner (creator) of the namespace
* nspacl access privilege list
* ----------------------------------------------------------------
*/
CATALOG(pg_namespace)
{
NameData nspname;
int4 nspowner;
aclitem nspacl[1]; /* VARIABLE LENGTH FIELD */
} FormData_pg_namespace;
/* ----------------
* Form_pg_namespace corresponds to a pointer to a tuple with
* the format of pg_namespace relation.
* ----------------
*/
typedef FormData_pg_namespace *Form_pg_namespace;
/* ----------------
* compiler constants for pg_namespace
* ----------------
*/
#define Natts_pg_namespace 3
#define Anum_pg_namespace_nspname 1
#define Anum_pg_namespace_nspowner 2
#define Anum_pg_namespace_nspacl 3
/* ----------------
* initial contents of pg_namespace
* ---------------
*/
DATA(insert OID = 11 ( "pg_catalog" PGUID "{=r}" ));
DESCR("System catalog namespace");
#define PG_CATALOG_NAMESPACE 11
/*
* prototypes for functions in pg_namespace.c
*/
extern Oid NamespaceCreate(const char *nspName);
#endif /* PG_NAMESPACE_H */

View File

@ -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.38 2002/03/21 23:27:25 tgl Exp $
* $Id: syscache.h,v 1.39 2002/03/22 21:34:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -45,18 +45,20 @@
#define INHRELID 14
#define LANGNAME 15
#define LANGOID 16
#define OPERNAME 17
#define OPEROID 18
#define PROCNAME 19
#define PROCOID 20
#define RELNAME 21
#define RELOID 22
#define RULENAME 23
#define SHADOWNAME 24
#define SHADOWSYSID 25
#define STATRELATT 26
#define TYPENAME 27
#define TYPEOID 28
#define NAMESPACENAME 17
#define NAMESPACEOID 18
#define OPERNAME 19
#define OPEROID 20
#define PROCNAME 21
#define PROCOID 22
#define RELNAME 23
#define RELOID 24
#define RULENAME 25
#define SHADOWNAME 26
#define SHADOWSYSID 27
#define STATRELATT 28
#define TYPENAME 29
#define TYPEOID 30
extern void InitCatalogCache(void);