Allow indexes on system catalogs for use in cache code.
Thanks to Hiroshi
This commit is contained in:
parent
1973e90ce2
commit
d16b706e7a
src
backend
include
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.92 1999/10/26 03:12:33 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.93 1999/11/01 02:29:24 momjian Exp $
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* INTERFACE ROUTINES
|
* INTERFACE ROUTINES
|
||||||
@ -54,26 +54,23 @@
|
|||||||
|
|
||||||
/* non-export function prototypes */
|
/* non-export function prototypes */
|
||||||
static Oid GetHeapRelationOid(char *heapRelationName, char *indexRelationName,
|
static Oid GetHeapRelationOid(char *heapRelationName, char *indexRelationName,
|
||||||
bool istemp);
|
bool istemp);
|
||||||
static TupleDesc BuildFuncTupleDesc(FuncIndexInfo *funcInfo);
|
static TupleDesc BuildFuncTupleDesc(FuncIndexInfo *funcInfo);
|
||||||
static TupleDesc ConstructTupleDescriptor(Oid heapoid, Relation heapRelation,
|
static TupleDesc ConstructTupleDescriptor(Oid heapoid, Relation heapRelation,
|
||||||
List *attributeList,
|
List *attributeList, int numatts, AttrNumber *attNums);
|
||||||
int numatts, AttrNumber *attNums);
|
|
||||||
|
|
||||||
static void ConstructIndexReldesc(Relation indexRelation, Oid amoid);
|
static void ConstructIndexReldesc(Relation indexRelation, Oid amoid);
|
||||||
static Oid UpdateRelationRelation(Relation indexRelation, char *temp_relname);
|
static Oid UpdateRelationRelation(Relation indexRelation, char *temp_relname);
|
||||||
static void InitializeAttributeOids(Relation indexRelation,
|
static void InitializeAttributeOids(Relation indexRelation,
|
||||||
int numatts,
|
int numatts, Oid indexoid);
|
||||||
Oid indexoid);
|
static void AppendAttributeTuples(Relation indexRelation, int numatts);
|
||||||
static void
|
|
||||||
AppendAttributeTuples(Relation indexRelation, int numatts);
|
|
||||||
static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
|
static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
|
||||||
FuncIndexInfo *funcInfo, int natts,
|
FuncIndexInfo *funcInfo, int natts,
|
||||||
AttrNumber *attNums, Oid *classOids, Node *predicate,
|
AttrNumber *attNums, Oid *classOids, Node *predicate,
|
||||||
List *attributeList, bool islossy, bool unique, bool primary);
|
List *attributeList, bool islossy, bool unique, bool primary);
|
||||||
static void DefaultBuild(Relation heapRelation, Relation indexRelation,
|
static void DefaultBuild(Relation heapRelation, Relation indexRelation,
|
||||||
int numberOfAttributes, AttrNumber *attributeNumber,
|
int numberOfAttributes, AttrNumber *attributeNumber,
|
||||||
IndexStrategy indexStrategy, uint16 parameterCount,
|
IndexStrategy indexStrategy, uint16 parameterCount,
|
||||||
Datum *parameter, FuncIndexInfoPtr funcInfo, PredInfo *predInfo);
|
Datum *parameter, FuncIndexInfoPtr funcInfo, PredInfo *predInfo);
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
@ -661,6 +658,7 @@ UpdateIndexRelation(Oid indexoid,
|
|||||||
Relation pg_index;
|
Relation pg_index;
|
||||||
HeapTuple tuple;
|
HeapTuple tuple;
|
||||||
int i;
|
int i;
|
||||||
|
Relation idescs[Num_pg_index_indices];
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* allocate an Form_pg_index big enough to hold the
|
* allocate an Form_pg_index big enough to hold the
|
||||||
@ -752,6 +750,16 @@ UpdateIndexRelation(Oid indexoid,
|
|||||||
*/
|
*/
|
||||||
heap_insert(pg_index, tuple);
|
heap_insert(pg_index, tuple);
|
||||||
|
|
||||||
|
/* ----------------
|
||||||
|
* insert the index tuple into the pg_index
|
||||||
|
* ----------------
|
||||||
|
*/
|
||||||
|
if (!IsBootstrapProcessingMode())
|
||||||
|
{
|
||||||
|
CatalogOpenIndices(Num_pg_index_indices, Name_pg_index_indices, idescs);
|
||||||
|
CatalogIndexInsert(idescs, Num_pg_index_indices, pg_index, tuple);
|
||||||
|
CatalogCloseIndices(Num_pg_index_indices, idescs);
|
||||||
|
}
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* close the relation and free the tuple
|
* close the relation and free the tuple
|
||||||
* ----------------
|
* ----------------
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.48 1999/10/15 01:49:39 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.49 1999/11/01 02:29:25 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -38,15 +38,17 @@
|
|||||||
* pg_trigger
|
* pg_trigger
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
char *Name_pg_amop_indices[Num_pg_amop_indices] = {AccessMethodOpidIndex,
|
||||||
|
AccessMethodStrategyIndex};
|
||||||
char *Name_pg_attr_indices[Num_pg_attr_indices] = {AttributeNameIndex,
|
char *Name_pg_attr_indices[Num_pg_attr_indices] = {AttributeNameIndex,
|
||||||
AttributeNumIndex,
|
AttributeNumIndex, AttributeRelidIndex};
|
||||||
AttributeRelidIndex};
|
char *Name_pg_index_indices[Num_pg_index_indices] = {IndexRelidIndex};
|
||||||
char *Name_pg_proc_indices[Num_pg_proc_indices] = {ProcedureNameIndex,
|
char *Name_pg_proc_indices[Num_pg_proc_indices] = {ProcedureNameIndex,
|
||||||
ProcedureOidIndex};
|
ProcedureOidIndex};
|
||||||
char *Name_pg_type_indices[Num_pg_type_indices] = {TypeNameIndex,
|
char *Name_pg_type_indices[Num_pg_type_indices] = {TypeNameIndex,
|
||||||
TypeOidIndex};
|
TypeOidIndex};
|
||||||
char *Name_pg_class_indices[Num_pg_class_indices] = {ClassNameIndex,
|
char *Name_pg_class_indices[Num_pg_class_indices] = {ClassNameIndex,
|
||||||
ClassOidIndex};
|
ClassOidIndex};
|
||||||
char *Name_pg_attrdef_indices[Num_pg_attrdef_indices] = {AttrDefaultIndex};
|
char *Name_pg_attrdef_indices[Num_pg_attrdef_indices] = {AttrDefaultIndex};
|
||||||
|
|
||||||
char *Name_pg_relcheck_indices[Num_pg_relcheck_indices] = {RelCheckIndex};
|
char *Name_pg_relcheck_indices[Num_pg_relcheck_indices] = {RelCheckIndex};
|
||||||
@ -255,12 +257,89 @@ CatalogIndexFetchTuple(Relation heapRelation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------
|
||||||
|
* Class-specific index lookups
|
||||||
|
*---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The remainder of the file is for individual index scan routines. Each
|
* The remainder of the file is for individual index scan routines. Each
|
||||||
* index should be scanned according to how it was defined during bootstrap
|
* index should be scanned according to how it was defined during bootstrap
|
||||||
* (that is, functional or normal) and what arguments the cache lookup
|
* (that is, functional or normal) and what arguments the cache lookup
|
||||||
* requires. Each routine returns the heap tuple that qualifies.
|
* requires. Each routine returns the heap tuple that qualifies.
|
||||||
*/
|
*/
|
||||||
|
HeapTuple
|
||||||
|
AccessMethodOpidIndexScan(Relation heapRelation,
|
||||||
|
Oid claid,
|
||||||
|
Oid opopr,
|
||||||
|
Oid opid)
|
||||||
|
{
|
||||||
|
Relation idesc;
|
||||||
|
ScanKeyData skey[3];
|
||||||
|
HeapTuple tuple;
|
||||||
|
|
||||||
|
ScanKeyEntryInitialize(&skey[0],
|
||||||
|
(bits16) 0x0,
|
||||||
|
(AttrNumber) 1,
|
||||||
|
(RegProcedure) F_OIDEQ,
|
||||||
|
ObjectIdGetDatum(claid));
|
||||||
|
|
||||||
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
|
(bits16) 0x0,
|
||||||
|
(AttrNumber) 2,
|
||||||
|
(RegProcedure) F_OIDEQ,
|
||||||
|
ObjectIdGetDatum(opopr));
|
||||||
|
|
||||||
|
ScanKeyEntryInitialize(&skey[2],
|
||||||
|
(bits16) 0x0,
|
||||||
|
(AttrNumber) 3,
|
||||||
|
(RegProcedure) F_OIDEQ,
|
||||||
|
ObjectIdGetDatum(opid));
|
||||||
|
|
||||||
|
idesc = index_openr(AccessMethodOpidIndex);
|
||||||
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 3);
|
||||||
|
|
||||||
|
index_close(idesc);
|
||||||
|
|
||||||
|
return tuple;
|
||||||
|
}
|
||||||
|
|
||||||
|
HeapTuple
|
||||||
|
AccessMethodStrategyIndexScan(Relation heapRelation,
|
||||||
|
Oid opid,
|
||||||
|
Oid claid,
|
||||||
|
int2 opstrategy)
|
||||||
|
{
|
||||||
|
Relation idesc;
|
||||||
|
ScanKeyData skey[3];
|
||||||
|
HeapTuple tuple;
|
||||||
|
|
||||||
|
ScanKeyEntryInitialize(&skey[0],
|
||||||
|
(bits16) 0x0,
|
||||||
|
(AttrNumber) 1,
|
||||||
|
(RegProcedure) F_OIDEQ,
|
||||||
|
ObjectIdGetDatum(opid));
|
||||||
|
|
||||||
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
|
(bits16) 0x0,
|
||||||
|
(AttrNumber) 2,
|
||||||
|
(RegProcedure) F_OIDEQ,
|
||||||
|
ObjectIdGetDatum(claid));
|
||||||
|
|
||||||
|
ScanKeyEntryInitialize(&skey[2],
|
||||||
|
(bits16) 0x0,
|
||||||
|
(AttrNumber) 3,
|
||||||
|
(RegProcedure) F_INT2EQ,
|
||||||
|
Int16GetDatum(opstrategy));
|
||||||
|
|
||||||
|
idesc = index_openr(AccessMethodStrategyIndex);
|
||||||
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 3);
|
||||||
|
|
||||||
|
index_close(idesc);
|
||||||
|
|
||||||
|
return tuple;
|
||||||
|
}
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
AttributeNameIndexScan(Relation heapRelation,
|
AttributeNameIndexScan(Relation heapRelation,
|
||||||
Oid relid,
|
Oid relid,
|
||||||
@ -320,6 +399,28 @@ AttributeNumIndexScan(Relation heapRelation,
|
|||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HeapTuple
|
||||||
|
IndexRelidIndexScan(Relation heapRelation, Oid relid)
|
||||||
|
{
|
||||||
|
Relation idesc;
|
||||||
|
ScanKeyData skey[1];
|
||||||
|
HeapTuple tuple;
|
||||||
|
|
||||||
|
ScanKeyEntryInitialize(&skey[0],
|
||||||
|
(bits16) 0x0,
|
||||||
|
(AttrNumber) 1,
|
||||||
|
(RegProcedure) F_OIDEQ,
|
||||||
|
ObjectIdGetDatum(relid));
|
||||||
|
|
||||||
|
idesc = index_openr(IndexRelidIndex);
|
||||||
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
|
|
||||||
|
index_close(idesc);
|
||||||
|
|
||||||
|
return tuple;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
ProcedureOidIndexScan(Relation heapRelation, Oid procId)
|
ProcedureOidIndexScan(Relation heapRelation, Oid procId)
|
||||||
|
69
src/backend/utils/cache/catcache.c
vendored
69
src/backend/utils/cache/catcache.c
vendored
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.49 1999/09/18 19:07:55 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.50 1999/11/01 02:29:25 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -16,9 +16,12 @@
|
|||||||
#include "access/heapam.h"
|
#include "access/heapam.h"
|
||||||
#include "access/valid.h"
|
#include "access/valid.h"
|
||||||
#include "catalog/pg_type.h"
|
#include "catalog/pg_type.h"
|
||||||
|
#include "catalog/catname.h"
|
||||||
|
#include "catalog/indexing.h"
|
||||||
#include "miscadmin.h"
|
#include "miscadmin.h"
|
||||||
#include "utils/builtins.h"
|
#include "utils/builtins.h"
|
||||||
#include "utils/catcache.h"
|
#include "utils/catcache.h"
|
||||||
|
#include "utils/syscache.h"
|
||||||
|
|
||||||
static void CatCacheRemoveCTup(CatCache *cache, Dlelem *e);
|
static void CatCacheRemoveCTup(CatCache *cache, Dlelem *e);
|
||||||
static Index CatalogCacheComputeHashIndex(struct catcache * cacheInP);
|
static Index CatalogCacheComputeHashIndex(struct catcache * cacheInP);
|
||||||
@ -805,6 +808,62 @@ InitSysCache(char *relname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------
|
||||||
|
* SearchSelfReferences
|
||||||
|
*
|
||||||
|
* This call searches a self referencing information,
|
||||||
|
*
|
||||||
|
* which causes a cycle in system catalog cache
|
||||||
|
*
|
||||||
|
* cache should already be initailized
|
||||||
|
* --------------------------------
|
||||||
|
*/
|
||||||
|
static HeapTuple
|
||||||
|
SearchSelfReferences(const struct catcache * cache)
|
||||||
|
{
|
||||||
|
HeapTuple ntp;
|
||||||
|
Relation rel;
|
||||||
|
static Oid indexSelfOid = 0;
|
||||||
|
static HeapTuple indexSelfTuple = 0;
|
||||||
|
|
||||||
|
if (cache->id != INDEXRELID)
|
||||||
|
return (HeapTuple)0;
|
||||||
|
|
||||||
|
if (!indexSelfOid)
|
||||||
|
{
|
||||||
|
rel = heap_openr(RelationRelationName, AccessShareLock);
|
||||||
|
ntp = ClassNameIndexScan(rel, IndexRelidIndex);
|
||||||
|
if (!HeapTupleIsValid(ntp))
|
||||||
|
elog(ERROR, "SearchSelfRefernces: %s not found in %s",
|
||||||
|
IndexRelidIndex, RelationRelationName);
|
||||||
|
indexSelfOid = ntp->t_data->t_oid;
|
||||||
|
pfree(ntp);
|
||||||
|
heap_close(rel, AccessShareLock);
|
||||||
|
}
|
||||||
|
if ((Oid)cache->cc_skey[0].sk_argument != indexSelfOid)
|
||||||
|
return (HeapTuple)0;
|
||||||
|
if (!indexSelfTuple)
|
||||||
|
{
|
||||||
|
HeapScanDesc sd;
|
||||||
|
MemoryContext oldcxt;
|
||||||
|
|
||||||
|
if (!CacheCxt)
|
||||||
|
CacheCxt = CreateGlobalMemory("Cache");
|
||||||
|
rel = heap_open(cache->relationId, AccessShareLock);
|
||||||
|
sd = heap_beginscan(rel, false, SnapshotNow, 1, cache->cc_skey);
|
||||||
|
ntp = heap_getnext(sd, 0);
|
||||||
|
if (!HeapTupleIsValid(ntp))
|
||||||
|
elog(ERROR, "SearchSelfRefernces: tuple not found");
|
||||||
|
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
|
||||||
|
indexSelfTuple = heap_copytuple(ntp);
|
||||||
|
MemoryContextSwitchTo(oldcxt);
|
||||||
|
heap_endscan(sd);
|
||||||
|
heap_close(rel, AccessShareLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
return indexSelfTuple;
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------
|
/* --------------------------------
|
||||||
* SearchSysCache
|
* SearchSysCache
|
||||||
*
|
*
|
||||||
@ -845,6 +904,14 @@ SearchSysCache(struct catcache * cache,
|
|||||||
cache->cc_skey[2].sk_argument = v3;
|
cache->cc_skey[2].sk_argument = v3;
|
||||||
cache->cc_skey[3].sk_argument = v4;
|
cache->cc_skey[3].sk_argument = v4;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* resolve self referencing informtion
|
||||||
|
*/
|
||||||
|
if (ntp = SearchSelfReferences(cache), ntp)
|
||||||
|
{
|
||||||
|
return heap_copytuple(ntp);
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* find the hash bucket in which to look for the tuple
|
* find the hash bucket in which to look for the tuple
|
||||||
* ----------------
|
* ----------------
|
||||||
|
25
src/backend/utils/cache/syscache.c
vendored
25
src/backend/utils/cache/syscache.c
vendored
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.37 1999/09/30 10:31:43 wieck Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.38 1999/11/01 02:29:25 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* These routines allow the parser/planner/executor to perform
|
* These routines allow the parser/planner/executor to perform
|
||||||
@ -59,8 +59,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_amop),
|
sizeof(FormData_pg_amop),
|
||||||
NULL,
|
AccessMethodOpidIndex,
|
||||||
(ScanFunc) NULL},
|
(ScanFunc) AccessMethodOpidIndexScan},
|
||||||
{AccessMethodOperatorRelationName, /* AMOPSTRATEGY */
|
{AccessMethodOperatorRelationName, /* AMOPSTRATEGY */
|
||||||
3,
|
3,
|
||||||
{
|
{
|
||||||
@ -70,8 +70,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_amop),
|
sizeof(FormData_pg_amop),
|
||||||
NULL,
|
AccessMethodStrategyIndex,
|
||||||
(ScanFunc) NULL},
|
(ScanFunc) AccessMethodStrategyIndexScan},
|
||||||
{AttributeRelationName, /* ATTNAME */
|
{AttributeRelationName, /* ATTNAME */
|
||||||
2,
|
2,
|
||||||
{
|
{
|
||||||
@ -103,8 +103,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_index, indpred),
|
offsetof(FormData_pg_index, indpred),
|
||||||
NULL,
|
IndexRelidIndex,
|
||||||
NULL},
|
(ScanFunc) IndexRelidIndexScan},
|
||||||
{LanguageRelationName, /* LANNAME */
|
{LanguageRelationName, /* LANNAME */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -226,17 +226,6 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
sizeof(FormData_pg_opclass),
|
sizeof(FormData_pg_opclass),
|
||||||
NULL,
|
NULL,
|
||||||
NULL},
|
NULL},
|
||||||
{IndexRelationName, /* INDRELIDKEY *//* never used */
|
|
||||||
2,
|
|
||||||
{
|
|
||||||
Anum_pg_index_indrelid,
|
|
||||||
Anum_pg_index_indkey,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
},
|
|
||||||
offsetof(FormData_pg_index, indpred),
|
|
||||||
NULL,
|
|
||||||
(ScanFunc) NULL},
|
|
||||||
{InheritsRelationName, /* INHRELID */
|
{InheritsRelationName, /* INHRELID */
|
||||||
2,
|
2,
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: indexing.h,v 1.25 1999/09/30 10:31:44 wieck Exp $
|
* $Id: indexing.h,v 1.26 1999/11/01 02:29:26 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -19,7 +19,9 @@
|
|||||||
/*
|
/*
|
||||||
* Some definitions for indices on pg_attribute
|
* Some definitions for indices on pg_attribute
|
||||||
*/
|
*/
|
||||||
|
#define Num_pg_amop_indices 2
|
||||||
#define Num_pg_attr_indices 3
|
#define Num_pg_attr_indices 3
|
||||||
|
#define Num_pg_index_indices 1
|
||||||
#define Num_pg_proc_indices 2
|
#define Num_pg_proc_indices 2
|
||||||
#define Num_pg_type_indices 2
|
#define Num_pg_type_indices 2
|
||||||
#define Num_pg_class_indices 2
|
#define Num_pg_class_indices 2
|
||||||
@ -32,8 +34,11 @@
|
|||||||
/*
|
/*
|
||||||
* Names of indices on system catalogs
|
* Names of indices on system catalogs
|
||||||
*/
|
*/
|
||||||
|
#define AccessMethodOpidIndex "pg_amop_opid_index"
|
||||||
|
#define AccessMethodStrategyIndex "pg_amop_strategy_index"
|
||||||
#define AttributeNameIndex "pg_attribute_relid_attnam_index"
|
#define AttributeNameIndex "pg_attribute_relid_attnam_index"
|
||||||
#define AttributeNumIndex "pg_attribute_relid_attnum_index"
|
#define AttributeNumIndex "pg_attribute_relid_attnum_index"
|
||||||
|
#define IndexRelidIndex "pg_index_indexrelid_index"
|
||||||
#define AttributeRelidIndex "pg_attribute_attrelid_index"
|
#define AttributeRelidIndex "pg_attribute_attrelid_index"
|
||||||
#define ProcedureOidIndex "pg_proc_oid_index"
|
#define ProcedureOidIndex "pg_proc_oid_index"
|
||||||
#define ProcedureNameIndex "pg_proc_proname_narg_type_index"
|
#define ProcedureNameIndex "pg_proc_proname_narg_type_index"
|
||||||
@ -48,7 +53,9 @@
|
|||||||
#define TriggerConstrRelidIndex "pg_trigger_tgconstrrelid_index"
|
#define TriggerConstrRelidIndex "pg_trigger_tgconstrrelid_index"
|
||||||
#define DescriptionObjIndex "pg_description_objoid_index"
|
#define DescriptionObjIndex "pg_description_objoid_index"
|
||||||
|
|
||||||
|
extern char *Name_pg_amop_indices[];
|
||||||
extern char *Name_pg_attr_indices[];
|
extern char *Name_pg_attr_indices[];
|
||||||
|
extern char *Name_pg_index_indices[];
|
||||||
extern char *Name_pg_proc_indices[];
|
extern char *Name_pg_proc_indices[];
|
||||||
extern char *Name_pg_type_indices[];
|
extern char *Name_pg_type_indices[];
|
||||||
extern char *Name_pg_class_indices[];
|
extern char *Name_pg_class_indices[];
|
||||||
@ -57,6 +64,7 @@ extern char *Name_pg_relcheck_indices[];
|
|||||||
extern char *Name_pg_trigger_indices[];
|
extern char *Name_pg_trigger_indices[];
|
||||||
extern char *Name_pg_description_indices[];
|
extern char *Name_pg_description_indices[];
|
||||||
|
|
||||||
|
|
||||||
extern char *IndexedCatalogNames[];
|
extern char *IndexedCatalogNames[];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -72,13 +80,17 @@ extern void CatalogIndexInsert(Relation *idescs,
|
|||||||
HeapTuple heapTuple);
|
HeapTuple heapTuple);
|
||||||
extern bool CatalogHasIndex(char *catName, Oid catId);
|
extern bool CatalogHasIndex(char *catName, Oid catId);
|
||||||
|
|
||||||
|
extern HeapTuple AccessMethodOpidIndexScan(Relation heapRelation,
|
||||||
|
Oid claid, Oid opopr, Oid opid);
|
||||||
|
extern HeapTuple AccessMethodStrategyIndexScan(Relation heapRelation,
|
||||||
|
Oid opid, Oid claid, int2 opstrategy);
|
||||||
extern HeapTuple AttributeNameIndexScan(Relation heapRelation,
|
extern HeapTuple AttributeNameIndexScan(Relation heapRelation,
|
||||||
Oid relid,
|
Oid relid,
|
||||||
char *attname);
|
char *attname);
|
||||||
|
|
||||||
extern HeapTuple AttributeNumIndexScan(Relation heapRelation,
|
extern HeapTuple AttributeNumIndexScan(Relation heapRelation,
|
||||||
Oid relid,
|
Oid relid,
|
||||||
AttrNumber attnum);
|
AttrNumber attnum);
|
||||||
|
extern HeapTuple IndexRelidIndexScan(Relation heapRelation, Oid relid);
|
||||||
extern HeapTuple ProcedureOidIndexScan(Relation heapRelation, Oid procId);
|
extern HeapTuple ProcedureOidIndexScan(Relation heapRelation, Oid procId);
|
||||||
extern HeapTuple ProcedureNameIndexScan(Relation heapRelation,
|
extern HeapTuple ProcedureNameIndexScan(Relation heapRelation,
|
||||||
char *procName, int2 nargs, Oid *argTypes);
|
char *procName, int2 nargs, Oid *argTypes);
|
||||||
@ -88,6 +100,8 @@ extern HeapTuple ClassNameIndexScan(Relation heapRelation, char *relName);
|
|||||||
extern HeapTuple ClassOidIndexScan(Relation heapRelation, Oid relId);
|
extern HeapTuple ClassOidIndexScan(Relation heapRelation, Oid relId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* What follows are lines processed by genbki.sh to create the statements
|
* What follows are lines processed by genbki.sh to create the statements
|
||||||
* the bootstrap parser will turn into DefineIndex commands.
|
* the bootstrap parser will turn into DefineIndex commands.
|
||||||
@ -95,10 +109,15 @@ extern HeapTuple ClassOidIndexScan(Relation heapRelation, Oid relId);
|
|||||||
* The keyword is DECLARE_INDEX every thing after that is just like in a
|
* The keyword is DECLARE_INDEX every thing after that is just like in a
|
||||||
* normal specification of the 'define index' POSTQUEL command.
|
* normal specification of the 'define index' POSTQUEL command.
|
||||||
*/
|
*/
|
||||||
|
DECLARE_INDEX(pg_amop_opid_index on pg_amop using btree(amopclaid oid_ops, amopopr oid_ops, amopid oid_ops));
|
||||||
|
DECLARE_INDEX(pg_amop_strategy_index on pg_amop using btree(amopid oid_ops, amopclaid oid_ops, amopstrategy int2_ops));
|
||||||
|
|
||||||
DECLARE_INDEX(pg_attribute_relid_attnam_index on pg_attribute using btree(attrelid oid_ops, attname name_ops));
|
DECLARE_INDEX(pg_attribute_relid_attnam_index on pg_attribute using btree(attrelid oid_ops, attname name_ops));
|
||||||
DECLARE_INDEX(pg_attribute_relid_attnum_index on pg_attribute using btree(attrelid oid_ops, attnum int2_ops));
|
DECLARE_INDEX(pg_attribute_relid_attnum_index on pg_attribute using btree(attrelid oid_ops, attnum int2_ops));
|
||||||
DECLARE_INDEX(pg_attribute_attrelid_index on pg_attribute using btree(attrelid oid_ops));
|
DECLARE_INDEX(pg_attribute_attrelid_index on pg_attribute using btree(attrelid oid_ops));
|
||||||
|
|
||||||
|
DECLARE_INDEX(pg_index_indexrelid_index on pg_index using btree(indexrelid oid_ops));
|
||||||
|
|
||||||
DECLARE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops));
|
DECLARE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops));
|
||||||
DECLARE_INDEX(pg_proc_proname_narg_type_index on pg_proc using btree(proname name_ops, pronargs int2_ops, proargtypes oid8_ops));
|
DECLARE_INDEX(pg_proc_proname_narg_type_index on pg_proc using btree(proname name_ops, pronargs int2_ops, proargtypes oid8_ops));
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: syscache.h,v 1.19 1999/09/30 10:31:47 wieck Exp $
|
* $Id: syscache.h,v 1.20 1999/11/01 02:29:27 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -48,18 +48,18 @@
|
|||||||
#define TYPOID 13
|
#define TYPOID 13
|
||||||
#define AMNAME 14
|
#define AMNAME 14
|
||||||
#define CLANAME 15
|
#define CLANAME 15
|
||||||
#define INDRELIDKEY 16
|
/* #define INDRELIDKEY 16 */
|
||||||
#define INHRELID 17
|
#define INHRELID 16
|
||||||
#define RULOID 18
|
#define RULOID 17
|
||||||
#define AGGNAME 19
|
#define AGGNAME 18
|
||||||
#define LISTENREL 20
|
#define LISTENREL 19
|
||||||
#define USENAME 21
|
#define USENAME 20
|
||||||
#define USESYSID 22
|
#define USESYSID 21
|
||||||
#define GRONAME 23
|
#define GRONAME 22
|
||||||
#define GROSYSID 24
|
#define GROSYSID 23
|
||||||
#define REWRITENAME 25
|
#define REWRITENAME 24
|
||||||
#define CLADEFTYPE 26
|
#define CLADEFTYPE 25
|
||||||
#define LANOID 27
|
#define LANOID 26
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* struct cachedesc: information needed for a call to InitSysCache()
|
* struct cachedesc: information needed for a call to InitSysCache()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user