aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/executor/hashjoin.h4
-rw-r--r--src/include/lib/dllist.h42
-rw-r--r--src/include/nodes/makefuncs.h7
-rw-r--r--src/include/parser/parse_oper.h11
-rw-r--r--src/include/parser/parse_type.h9
-rw-r--r--src/include/rewrite/rewriteSupport.h4
-rw-r--r--src/include/utils/catcache.h36
-rw-r--r--src/include/utils/lsyscache.h4
-rw-r--r--src/include/utils/syscache.h20
9 files changed, 90 insertions, 47 deletions
diff --git a/src/include/executor/hashjoin.h b/src/include/executor/hashjoin.h
index 25a8174f294..28581ad425a 100644
--- a/src/include/executor/hashjoin.h
+++ b/src/include/executor/hashjoin.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: hashjoin.h,v 1.19 2000/08/22 04:06:21 tgl Exp $
+ * $Id: hashjoin.h,v 1.20 2000/11/16 22:30:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -73,8 +73,8 @@ typedef struct HashTableData
* and outer sides of the hash are the same type, or at least
* binary-compatible types.
*/
+ int16 typLen;
bool typByVal;
- int typLen;
/*
* During 1st scan of inner relation, we get tuples from executor. If
diff --git a/src/include/lib/dllist.h b/src/include/lib/dllist.h
index 9e357a7fd76..9306d4e6b67 100644
--- a/src/include/lib/dllist.h
+++ b/src/include/lib/dllist.h
@@ -2,12 +2,11 @@
*
* dllist.h
* simple doubly linked list primitives
- * the elements of the list are void* so the lists can contain
- * anything
+ * the elements of the list are void* so the lists can contain anything
* Dlelem can only be in one list at a time
*
*
- * Here's a small example of how to use Dllist's :
+ * Here's a small example of how to use Dllists:
*
* Dllist *lst;
* Dlelem *elt;
@@ -24,10 +23,18 @@
* DLFreeElem(elt); -- free the element since we don't
* use it anymore
*
+ *
+ * It is also possible to use Dllist objects that are embedded in larger
+ * structures instead of being separately malloc'd. To do this, use
+ * DLInitElem() to initialize a Dllist field within a larger object.
+ * Don't forget to DLRemove() each field from its list (if any) before
+ * freeing the larger object!
+ *
+ *
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: dllist.h,v 1.13 2000/06/08 22:37:46 momjian Exp $
+ * $Id: dllist.h,v 1.14 2000/11/16 22:30:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +42,6 @@
#ifndef DLLIST_H
#define DLLIST_H
-
struct Dllist;
struct Dlelem;
@@ -53,21 +59,27 @@ typedef struct Dllist
Dlelem *dll_tail;
} Dllist;
-extern Dllist *DLNewList(void); /* initialize a new list */
-extern void DLFreeList(Dllist *); /* free up a list and all the
+extern Dllist *DLNewList(void); /* allocate and initialize a list header */
+extern void DLInitList(Dllist *list); /* init a header alloced by caller */
+extern void DLFreeList(Dllist *list); /* free up a list and all the
* nodes in it */
extern Dlelem *DLNewElem(void *val);
-extern void DLFreeElem(Dlelem *);
-extern Dlelem *DLGetHead(Dllist *);
-extern Dlelem *DLGetTail(Dllist *);
-extern Dlelem *DLRemTail(Dllist *l);
-extern Dlelem *DLGetSucc(Dlelem *); /* get successor */
-extern void DLRemove(Dlelem *); /* removes node from list */
+extern void DLInitElem(Dlelem *e, void *val);
+extern void DLFreeElem(Dlelem *e);
+extern void DLRemove(Dlelem *e); /* removes node from list */
extern void DLAddHead(Dllist *list, Dlelem *node);
extern void DLAddTail(Dllist *list, Dlelem *node);
extern Dlelem *DLRemHead(Dllist *list); /* remove and return the head */
-extern void DLMoveToFront(Dlelem *); /* move node to front of its list */
+extern Dlelem *DLRemTail(Dllist *list);
+extern void DLMoveToFront(Dlelem *e); /* move node to front of its list */
+
+/* These are macros for speed */
+#define DLGetHead(list) ((list)->dll_head)
+#define DLGetTail(list) ((list)->dll_tail)
+#define DLGetSucc(elem) ((elem)->dle_next)
+#define DLGetPred(elem) ((elem)->dle_prev)
+#define DLGetListHdr(elem) ((elem)->dle_list)
-#define DLE_VAL(x) (x->dle_val)
+#define DLE_VAL(elem) ((elem)->dle_val)
#endif /* DLLIST_H */
diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h
index 1ec37fc7b6f..08b0007fcaf 100644
--- a/src/include/nodes/makefuncs.h
+++ b/src/include/nodes/makefuncs.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: makefuncs.h,v 1.25 2000/08/08 15:42:59 tgl Exp $
+ * $Id: makefuncs.h,v 1.26 2000/11/16 22:30:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,7 +42,8 @@ extern Const *makeConst(Oid consttype,
bool constisset,
bool constiscast);
-extern Attr *
- makeAttr(char *relname, char *attname);
+extern Const *makeNullConst(Oid consttype);
+
+extern Attr *makeAttr(char *relname, char *attname);
#endif /* MAKEFUNC_H */
diff --git a/src/include/parser/parse_oper.h b/src/include/parser/parse_oper.h
index 4162cd6d234..4e3c784c0dc 100644
--- a/src/include/parser/parse_oper.h
+++ b/src/include/parser/parse_oper.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_oper.h,v 1.11 2000/01/26 05:58:27 momjian Exp $
+ * $Id: parse_oper.h,v 1.12 2000/11/16 22:30:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,10 +18,13 @@
typedef HeapTuple Operator;
-extern Oid any_ordering_op(Oid restype);
-extern Oid oprid(Operator op);
-extern Operator oper(char *op, Oid arg1, Oid arg2, bool noWarnings);
+extern Operator oper(char *op, Oid arg1, Oid arg2, bool noError);
extern Operator right_oper(char *op, Oid arg);
extern Operator left_oper(char *op, Oid arg);
+extern Oid oper_oid(char *op, Oid arg1, Oid arg2, bool noError);
+extern Oid oprid(Operator op);
+
+extern Oid any_ordering_op(Oid restype);
+
#endif /* PARSE_OPER_H */
diff --git a/src/include/parser/parse_type.h b/src/include/parser/parse_type.h
index e2cfd7f4a2d..0d8ba2f1bce 100644
--- a/src/include/parser/parse_type.h
+++ b/src/include/parser/parse_type.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_type.h,v 1.14 2000/06/08 22:37:53 momjian Exp $
+ * $Id: parse_type.h,v 1.15 2000/11/16 22:30:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,15 +21,18 @@ typedef HeapTuple Type;
extern bool typeidIsValid(Oid id);
extern Type typeidType(Oid id);
extern Type typenameType(char *s);
-extern char *typeidTypeName(Oid id);
+
extern Oid typeTypeId(Type tp);
extern int16 typeLen(Type t);
extern bool typeByVal(Type t);
extern char *typeTypeName(Type t);
extern char typeTypeFlag(Type t);
+extern Oid typeTypeRelid(Type typ);
extern Datum stringTypeDatum(Type tp, char *string, int32 atttypmod);
+
+extern char *typeidTypeName(Oid id);
extern Oid typeidTypeRelid(Oid type_id);
-extern Oid typeTypeRelid(Type typ);
+extern Oid typenameTypeId(char *s);
#define ISCOMPLEX(typeid) (typeidTypeRelid(typeid) != InvalidOid)
diff --git a/src/include/rewrite/rewriteSupport.h b/src/include/rewrite/rewriteSupport.h
index 39605df47ad..20cf82cbd91 100644
--- a/src/include/rewrite/rewriteSupport.h
+++ b/src/include/rewrite/rewriteSupport.h
@@ -7,14 +7,14 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: rewriteSupport.h,v 1.13 2000/09/29 18:21:24 tgl Exp $
+ * $Id: rewriteSupport.h,v 1.14 2000/11/16 22:30:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef REWRITESUPPORT_H
#define REWRITESUPPORT_H
-extern int IsDefinedRewriteRule(char *ruleName);
+extern bool IsDefinedRewriteRule(char *ruleName);
extern void SetRelationRuleStatus(Oid relationId, bool relHasRules,
bool relIsBecomingView);
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index e55b6492d8c..ed78284a478 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: catcache.h,v 1.27 2000/11/10 00:33:12 tgl Exp $
+ * $Id: catcache.h,v 1.28 2000/11/16 22:30:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,18 +32,29 @@
typedef struct catctup
{
- HeapTuple ct_tup; /* A pointer to a tuple */
+ int ct_magic; /* for Assert checks */
+#define CT_MAGIC 0x57261502
+
/*
- * Each tuple in the cache has two catctup items, one in the LRU list
- * and one in the hashbucket list for its hash value. ct_node in each
- * one points to the other one.
+ * Each tuple in a cache is a member of two lists: one lists all the
+ * elements in that cache in LRU order, and the other lists just the
+ * elements in one hashbucket, also in LRU order.
+ *
+ * A tuple marked "dead" must not be returned by subsequent searches.
+ * However, it won't be physically deleted from the cache until its
+ * refcount goes to zero.
*/
- Dlelem *ct_node; /* the other catctup for this tuple */
+ Dlelem lrulist_elem; /* list member of global LRU list */
+ Dlelem cache_elem; /* list member of per-bucket list */
+ int refcount; /* number of active references */
+ bool dead; /* dead but not yet removed? */
+ HeapTupleData tuple; /* tuple management header */
} CatCTup;
+
/* voodoo constants */
#define NCCBUCK 500 /* CatCache buckets */
-#define MAXTUP 300 /* Maximum # of tuples stored per cache */
+#define MAXTUP 500 /* Maximum # of tuples stored per cache */
typedef struct catcache
@@ -60,8 +71,8 @@ typedef struct catcache
short cc_key[4]; /* AttrNumber of each key */
PGFunction cc_hashfunc[4]; /* hash function to use for each key */
ScanKeyData cc_skey[4]; /* precomputed key info for indexscans */
- Dllist *cc_lrulist; /* LRU list, most recent first */
- Dllist *cc_cache[NCCBUCK + 1]; /* hash buckets */
+ Dllist cc_lrulist; /* overall LRU list, most recent first */
+ Dllist cc_cache[NCCBUCK]; /* hash buckets */
} CatCache;
#define InvalidCatalogCacheId (-1)
@@ -70,12 +81,15 @@ typedef struct catcache
extern MemoryContext CacheMemoryContext;
extern void CreateCacheMemoryContext(void);
+extern void AtEOXact_CatCache(bool isCommit);
-extern CatCache *InitSysCache(int id, char *relname, char *indname,
+extern CatCache *InitCatCache(int id, char *relname, char *indname,
int nkeys, int *key);
-extern HeapTuple SearchSysCache(CatCache *cache,
+
+extern HeapTuple SearchCatCache(CatCache *cache,
Datum v1, Datum v2,
Datum v3, Datum v4);
+extern void ReleaseCatCache(HeapTuple tuple);
extern void ResetSystemCache(void);
extern void SystemCacheRelationFlushed(Oid relId);
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 516949d1de9..f8547baa884 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: lsyscache.h,v 1.26 2000/10/05 19:48:34 momjian Exp $
+ * $Id: lsyscache.h,v 1.27 2000/11/16 22:30:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,7 +29,6 @@ extern bool op_mergejoinable(Oid opno, Oid ltype, Oid rtype,
Oid *leftOp, Oid *rightOp);
extern Oid op_hashjoinable(Oid opno, Oid ltype, Oid rtype);
extern bool op_iscachable(Oid opno);
-extern HeapTuple get_operator_tuple(Oid opno);
extern Oid get_commutator(Oid opno);
extern Oid get_negator(Oid opno);
extern RegProcedure get_oprrest(Oid opno);
@@ -39,6 +38,7 @@ extern bool func_iscachable(Oid funcid);
extern char *get_rel_name(Oid relid);
extern int16 get_typlen(Oid typid);
extern bool get_typbyval(Oid typid);
+extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
extern Datum get_typdefault(Oid typid);
#endif /* LSYSCACHE_H */
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index 5d17e8db44c..73abd53e134 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: syscache.h,v 1.26 2000/06/17 04:56:29 tgl Exp $
+ * $Id: syscache.h,v 1.27 2000/11/16 22:30:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,12 +57,22 @@
#define TYPENAME 26
#define TYPEOID 27
-extern void zerocaches(void);
extern void InitCatalogCache(void);
-extern HeapTuple SearchSysCacheTuple(int cacheId,
+
+extern HeapTuple SearchSysCache(int cacheId,
+ Datum key1, Datum key2, Datum key3, Datum key4);
+extern void ReleaseSysCache(HeapTuple tuple);
+
+/* convenience routines */
+extern HeapTuple SearchSysCacheCopy(int cacheId,
Datum key1, Datum key2, Datum key3, Datum key4);
-extern HeapTuple SearchSysCacheTupleCopy(int cacheId,
- Datum key1, Datum key2, Datum key3, Datum key4);
+extern Oid GetSysCacheOid(int cacheId,
+ Datum key1, Datum key2, Datum key3, Datum key4);
+
+/* macro for just probing for existence of a tuple via the syscache */
+#define SearchSysCacheExists(c,k1,k2,k3,k4) \
+ OidIsValid(GetSysCacheOid(c,k1,k2,k3,k4))
+
extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
AttrNumber attributeNumber, bool *isNull);