summaryrefslogtreecommitdiff
path: root/src/include/utils
diff options
context:
space:
mode:
authorTom Lane2000-07-12 02:37:39 +0000
committerTom Lane2000-07-12 02:37:39 +0000
commitbadce86a2c327b40c6146242526d1523455d64a6 (patch)
tree6e0cb658889a2688e76d9ac19a56555c5eb0e738 /src/include/utils
parent46fb9c29e2990ba470bb741ff6dd60f2ae218e64 (diff)
First stage of reclaiming memory in executor by resetting short-term
memory contexts. Currently, only leaks in expressions executed as quals or projections are handled. Clean up some old dead cruft in executor while at it --- unused fields in state nodes, that sort of thing.
Diffstat (limited to 'src/include/utils')
-rw-r--r--src/include/utils/datum.h63
-rw-r--r--src/include/utils/fcache.h13
2 files changed, 35 insertions, 41 deletions
diff --git a/src/include/utils/datum.h b/src/include/utils/datum.h
index 9079919fa06..199cf3109e1 100644
--- a/src/include/utils/datum.h
+++ b/src/include/utils/datum.h
@@ -1,64 +1,49 @@
/*-------------------------------------------------------------------------
*
* datum.h
- * POSTGRES abstract data type datum representation definitions.
+ * POSTGRES Datum (abstract data type) manipulation routines.
*
+ * These routines are driven by the 'typbyval' and 'typlen' information,
+ * which must previously have been obtained by the caller for the datatype
+ * of the Datum. (We do it this way because in most situations the caller
+ * can look up the info just once and use it for many per-datum operations.)
*
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: datum.h,v 1.10 2000/01/26 05:58:37 momjian Exp $
+ * $Id: datum.h,v 1.11 2000/07/12 02:37:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef DATUM_H
#define DATUM_H
-
-/*--------------------------------------------------------
- * SOME NOT VERY PORTABLE ROUTINES ???
- *--------------------------------------------------------
- *
- * In the implementation of the next routines we assume the following:
- *
- * A) if a type is "byVal" then all the information is stored in the
- * Datum itself (i.e. no pointers involved!). In this case the
- * length of the type is always greater than zero and less than
- * "sizeof(Datum)"
- * B) if a type is not "byVal" and it has a fixed length, then
- * the "Datum" always contain a pointer to a stream of bytes.
- * The number of significant bytes are always equal to the length of thr
- * type.
- * C) if a type is not "byVal" and is of variable length (i.e. it has
- * length == -1) then "Datum" always points to a "struct varlena".
- * This varlena structure has information about the actual length of this
- * particular instance of the type and about its value.
- */
-
-/*---------------
- * datumGetSize
- * find the "real" length of a datum
+/*
+ * datumGetSize - find the "real" length of a datum
*/
-extern Size datumGetSize(Datum value, Oid type, bool byVal, Size len);
+extern Size datumGetSize(Datum value, bool typByVal, int typLen);
-/*---------------
- * datumCopy
- * make a copy of a datum.
+/*
+ * datumCopy - make a copy of a datum.
+ *
+ * If the datatype is pass-by-reference, memory is obtained with palloc().
*/
-extern Datum datumCopy(Datum value, Oid type, bool byVal, Size len);
+extern Datum datumCopy(Datum value, bool typByVal, int typLen);
-/*---------------
- * datumFree
- * free space that *might* have been palloced by "datumCopy"
+/*
+ * datumFree - free a datum previously allocated by datumCopy, if any.
+ *
+ * Does nothing if datatype is pass-by-value.
*/
-extern void datumFree(Datum value, Oid type, bool byVal, Size len);
+extern void datumFree(Datum value, bool typByVal, int typLen);
-/*---------------
+/*
* datumIsEqual
- * return true if thwo datums are equal, false otherwise.
+ * return true if two datums of the same type are equal, false otherwise.
+ *
* XXX : See comments in the code for restrictions!
*/
-extern bool datumIsEqual(Datum value1, Datum value2, Oid type,
- bool byVal, Size len);
+extern bool datumIsEqual(Datum value1, Datum value2,
+ bool typByVal, int typLen);
#endif /* DATUM_H */
diff --git a/src/include/utils/fcache.h b/src/include/utils/fcache.h
index db3a05baf4b..59f35867a72 100644
--- a/src/include/utils/fcache.h
+++ b/src/include/utils/fcache.h
@@ -1,13 +1,17 @@
/*-------------------------------------------------------------------------
*
* fcache.h
+ * Declarations for function cache records.
*
- *
+ * The first time any Oper or Func node is evaluated, we compute a cache
+ * record for the function being invoked, and save a pointer to the cache
+ * record in the Oper or Func node. This saves repeated lookup of info
+ * about the function.
*
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: fcache.h,v 1.11 2000/05/28 17:56:20 tgl Exp $
+ * $Id: fcache.h,v 1.12 2000/07/12 02:37:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,6 +35,11 @@ typedef struct
* expr whose argument is func returning a
* set ugh! */
+ /* If additional info is added to an existing fcache, be sure to
+ * allocate it in the fcacheCxt.
+ */
+ MemoryContext fcacheCxt; /* context the fcache lives in */
+
int nargs; /* actual number of arguments */
Oid *argOidVect; /* oids of all the argument types */