summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-04-14 20:03:27 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-04-14 20:03:27 +0000
commit162bd08b3f2e6783d1d75ae79f86fc444d34a28d (patch)
tree0220cd8a906557db64763a1a57dd339de313d221 /src/include
parent9dc2e6deaf66f97ff9157478a517d0f48a1e5060 (diff)
Completion of project to use fixed OIDs for all system catalogs and
indexes. Replace all heap_openr and index_openr calls by heap_open and index_open. Remove runtime lookups of catalog OID numbers in various places. Remove relcache's support for looking up system catalogs by name. Bulky but mostly very boring patch ...
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/genam.h5
-rw-r--r--src/include/access/heapam.h4
-rw-r--r--src/include/catalog/catname.h48
-rw-r--r--src/include/catalog/indexing.h68
-rw-r--r--src/include/utils/catcache.h6
-rw-r--r--src/include/utils/lsyscache.h3
-rw-r--r--src/include/utils/relcache.h3
7 files changed, 13 insertions, 124 deletions
diff --git a/src/include/access/genam.h b/src/include/access/genam.h
index 89fd4f9db68..422e107ec51 100644
--- a/src/include/access/genam.h
+++ b/src/include/access/genam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.49 2005/03/27 23:53:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.50 2005/04/14 20:03:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,7 +70,6 @@ typedef SysScanDescData *SysScanDesc;
*/
extern Relation index_open(Oid relationId);
extern Relation index_openrv(const RangeVar *relation);
-extern Relation index_openr(const char *sysRelationName);
extern void index_close(Relation relation);
extern bool index_insert(Relation indexRelation,
Datum *values, bool *isnull,
@@ -119,7 +118,7 @@ extern void IndexScanEnd(IndexScanDesc scan);
* heap-or-index access to system catalogs (in genam.c)
*/
extern SysScanDesc systable_beginscan(Relation heapRelation,
- const char *indexRelname,
+ Oid indexId,
bool indexOK,
Snapshot snapshot,
int nkeys, ScanKey key);
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index 5bc9eed5606..8b18cc42248 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.98 2005/03/21 01:24:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.99 2005/04/14 20:03:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -126,12 +126,10 @@ extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
extern Relation relation_open(Oid relationId, LOCKMODE lockmode);
extern Relation conditional_relation_open(Oid relationId, LOCKMODE lockmode, bool nowait);
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_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/catalog/catname.h b/src/include/catalog/catname.h
deleted file mode 100644
index 27186ef0b23..00000000000
--- a/src/include/catalog/catname.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * catname.h
- * POSTGRES system catalog relation name definitions.
- *
- *
- * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * $PostgreSQL: pgsql/src/include/catalog/catname.h,v 1.35 2005/04/14 01:38:20 tgl Exp $
- *
- *-------------------------------------------------------------------------
- */
-#ifndef CATNAME_H
-#define CATNAME_H
-
-
-#define AggregateRelationName "pg_aggregate"
-#define AccessMethodRelationName "pg_am"
-#define AccessMethodOperatorRelationName "pg_amop"
-#define AccessMethodProcedureRelationName "pg_amproc"
-#define AttributeRelationName "pg_attribute"
-#define CastRelationName "pg_cast"
-#define ConstraintRelationName "pg_constraint"
-#define ConversionRelationName "pg_conversion"
-#define DatabaseRelationName "pg_database"
-#define DependRelationName "pg_depend"
-#define DescriptionRelationName "pg_description"
-#define GroupRelationName "pg_group"
-#define IndexRelationName "pg_index"
-#define InheritsRelationName "pg_inherits"
-#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"
-#define RelationRelationName "pg_class"
-#define RewriteRelationName "pg_rewrite"
-#define ShadowRelationName "pg_shadow"
-#define StatisticRelationName "pg_statistic"
-#define TableSpaceRelationName "pg_tablespace"
-#define TypeRelationName "pg_type"
-#define AttrDefaultRelationName "pg_attrdef"
-#define TriggerRelationName "pg_trigger"
-
-#endif /* CATNAME_H */
diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h
index a64771cd813..8be3527be2c 100644
--- a/src/include/catalog/indexing.h
+++ b/src/include/catalog/indexing.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/indexing.h,v 1.86 2005/04/14 01:38:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/indexing.h,v 1.87 2005/04/14 20:03:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,68 +17,6 @@
#include "access/htup.h"
-/*
- * Names of indexes on system catalogs
- *
- * References to specific system indexes in the C code should use these
- * macros rather than hardwiring the actual index name.
- */
-#define AccessMethodOperatorIndex "pg_amop_opr_opc_index"
-#define AccessMethodStrategyIndex "pg_amop_opc_strat_index"
-#define AccessMethodProcedureIndex "pg_amproc_opc_proc_index"
-#define AggregateFnoidIndex "pg_aggregate_fnoid_index"
-#define AmNameIndex "pg_am_name_index"
-#define AmOidIndex "pg_am_oid_index"
-#define AttrDefaultIndex "pg_attrdef_adrelid_adnum_index"
-#define AttrDefaultOidIndex "pg_attrdef_oid_index"
-#define AttributeRelidNameIndex "pg_attribute_relid_attnam_index"
-#define AttributeRelidNumIndex "pg_attribute_relid_attnum_index"
-#define CastOidIndex "pg_cast_oid_index"
-#define CastSourceTargetIndex "pg_cast_source_target_index"
-#define ClassNameNspIndex "pg_class_relname_nsp_index"
-#define ClassOidIndex "pg_class_oid_index"
-#define ConstraintNameNspIndex "pg_constraint_conname_nsp_index"
-#define ConstraintOidIndex "pg_constraint_oid_index"
-#define ConstraintRelidIndex "pg_constraint_conrelid_index"
-#define ConstraintTypidIndex "pg_constraint_contypid_index"
-#define ConversionDefaultIndex "pg_conversion_default_index"
-#define ConversionNameNspIndex "pg_conversion_name_nsp_index"
-#define ConversionOidIndex "pg_conversion_oid_index"
-#define DatabaseNameIndex "pg_database_datname_index"
-#define DatabaseOidIndex "pg_database_oid_index"
-#define DependDependerIndex "pg_depend_depender_index"
-#define DependReferenceIndex "pg_depend_reference_index"
-#define DescriptionObjIndex "pg_description_o_c_o_index"
-#define GroupNameIndex "pg_group_name_index"
-#define GroupSysidIndex "pg_group_sysid_index"
-#define IndexIndrelidIndex "pg_index_indrelid_index"
-#define IndexRelidIndex "pg_index_indexrelid_index"
-#define InheritsRelidSeqnoIndex "pg_inherits_relid_seqno_index"
-#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 OpclassAmNameNspIndex "pg_opclass_am_name_nsp_index"
-#define OpclassOidIndex "pg_opclass_oid_index"
-#define OperatorNameNspIndex "pg_operator_oprname_l_r_n_index"
-#define OperatorOidIndex "pg_operator_oid_index"
-#define ProcedureNameArgsNspIndex "pg_proc_proname_args_nsp_index"
-#define ProcedureOidIndex "pg_proc_oid_index"
-#define RewriteOidIndex "pg_rewrite_oid_index"
-#define RewriteRelRulenameIndex "pg_rewrite_rel_rulename_index"
-#define ShadowNameIndex "pg_shadow_usename_index"
-#define ShadowSysidIndex "pg_shadow_usesysid_index"
-#define StatisticRelidAttnumIndex "pg_statistic_relid_att_index"
-#define TablespaceNameIndex "pg_tablespace_spcname_index"
-#define TablespaceOidIndex "pg_tablespace_oid_index"
-#define TriggerConstrNameIndex "pg_trigger_tgconstrname_index"
-#define TriggerConstrRelidIndex "pg_trigger_tgconstrrelid_index"
-#define TriggerRelidNameIndex "pg_trigger_tgrelid_tgname_index"
-#define TriggerOidIndex "pg_trigger_oid_index"
-#define TypeNameNspIndex "pg_type_typname_nsp_index"
-#define TypeOidIndex "pg_type_oid_index"
-
/*
* The state object used by CatalogOpenIndexes and friends is actually the
@@ -113,6 +51,10 @@ extern void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple);
* The keyword is DECLARE_INDEX or DECLARE_UNIQUE_INDEX. The first two
* arguments are the index name and OID, the rest is much like a standard
* 'create index' SQL command.
+ *
+ * For each index, we also provide a #define for its OID. References to
+ * the index in the C code should always use these #defines, not the actual
+ * index name (much less the numeric OID).
*/
DECLARE_UNIQUE_INDEX(pg_aggregate_fnoid_index,2650, on pg_aggregate using btree(aggfnoid oid_ops));
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index a9e6f19b9c5..6aac341f71c 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.53 2005/03/25 18:30:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.54 2005/04/14 20:03:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,8 +36,8 @@ typedef struct catcache
int id; /* cache identifier --- see syscache.h */
struct catcache *cc_next; /* link to next catcache */
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 */
+ Oid cc_indexoid; /* OID of index matching cache keys */
bool cc_relisshared; /* is relation shared across databases? */
TupleDesc cc_tupdesc; /* tuple descriptor (copied from reldesc) */
int cc_reloidattr; /* AttrNumber of relation OID attr, or 0 */
@@ -164,7 +164,7 @@ extern DLLIMPORT MemoryContext CacheMemoryContext;
extern void CreateCacheMemoryContext(void);
extern void AtEOXact_CatCache(bool isCommit);
-extern CatCache *InitCatCache(int id, const char *relname, const char *indname,
+extern CatCache *InitCatCache(int id, Oid reloid, Oid indexoid,
int reloidattr,
int nkeys, const int *key);
extern void InitCatCachePhase2(CatCache *cache);
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index b98b53c60fc..42dbe3d2406 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.97 2005/04/11 23:06:56 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.98 2005/04/14 20:03:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -62,7 +62,6 @@ extern bool get_func_retset(Oid funcid);
extern bool func_strict(Oid funcid);
extern char func_volatile(Oid funcid);
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_type_id(Oid relid);
diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h
index e5e8c8e07a2..0f58921ea1a 100644
--- a/src/include/utils/relcache.h
+++ b/src/include/utils/relcache.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.49 2005/04/14 01:38:22 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.50 2005/04/14 20:03:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,7 +20,6 @@
* relation lookup routines
*/
extern Relation RelationIdGetRelation(Oid relationId);
-extern Relation RelationSysNameGetRelation(const char *relationName);
/* finds an existing cache entry, but won't make a new one */
extern Relation RelationIdCacheGetRelation(Oid relationId);