summaryrefslogtreecommitdiff
path: root/contrib/pgstattuple/pgstattuple.c
diff options
context:
space:
mode:
authorTom Lane2004-04-01 21:28:47 +0000
committerTom Lane2004-04-01 21:28:47 +0000
commit375369acd1c621bdc683c58bc9c31d4e79d14849 (patch)
treef29974842cea4105c92da6031bac736ddf5f833a /contrib/pgstattuple/pgstattuple.c
parent8590a62b75d3dba24609eb46b34fac13ed881d9e (diff)
Replace TupleTableSlot convention for whole-row variables and function
results with tuples as ordinary varlena Datums. This commit does not in itself do much for us, except eliminate the horrid memory leak associated with evaluation of whole-row variables. However, it lays the groundwork for allowing composite types as table columns, and perhaps some other useful features as well. Per my proposal of a few days ago.
Diffstat (limited to 'contrib/pgstattuple/pgstattuple.c')
-rw-r--r--contrib/pgstattuple/pgstattuple.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/contrib/pgstattuple/pgstattuple.c b/contrib/pgstattuple/pgstattuple.c
index abc2249aedf..ca082618568 100644
--- a/contrib/pgstattuple/pgstattuple.c
+++ b/contrib/pgstattuple/pgstattuple.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.13 2003/11/29 19:51:35 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.14 2004/04/01 21:28:43 tgl Exp $
*
* Copyright (c) 2001,2002 Tatsuo Ishii
*
@@ -111,7 +111,6 @@ pgstattuple_real(Relation rel)
uint64 free_space = 0; /* free/reusable space in bytes */
double free_percent; /* free/reusable space in % */
TupleDesc tupdesc;
- TupleTableSlot *slot;
AttInMetadata *attinmeta;
char **values;
int i;
@@ -122,9 +121,6 @@ pgstattuple_real(Relation rel)
*/
tupdesc = RelationNameGetTupleDesc(DUMMY_TUPLE);
- /* allocate a slot for a tuple with this tupdesc */
- slot = TupleDescGetSlot(tupdesc);
-
/*
* Generate attribute metadata needed later to produce tuples from raw
* C strings
@@ -192,7 +188,7 @@ pgstattuple_real(Relation rel)
}
/*
- * Prepare a values array for storage in our slot. This should be an
+ * Prepare a values array for constructing the tuple. This should be an
* array of C strings which will be processed later by the appropriate
* "in" functions.
*/
@@ -214,7 +210,7 @@ pgstattuple_real(Relation rel)
tuple = BuildTupleFromCStrings(attinmeta, values);
/* make the tuple into a datum */
- result = TupleGetDatum(slot, tuple);
+ result = HeapTupleGetDatum(tuple);
/* Clean up */
for (i = 0; i < NCOLUMNS; i++)