From 375369acd1c621bdc683c58bc9c31d4e79d14849 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 1 Apr 2004 21:28:47 +0000 Subject: 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. --- src/backend/utils/adt/lockfuncs.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/backend/utils/adt/lockfuncs.c') diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c index b009e167a3f..bc4901aa546 100644 --- a/src/backend/utils/adt/lockfuncs.c +++ b/src/backend/utils/adt/lockfuncs.c @@ -6,7 +6,7 @@ * Copyright (c) 2002-2003, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/lockfuncs.c,v 1.12 2003/11/29 19:51:58 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/lockfuncs.c,v 1.13 2004/04/01 21:28:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -52,22 +52,22 @@ pg_lock_status(PG_FUNCTION_ARGS) oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx); /* build tupdesc for result tuples */ - /* this had better match pg_locks view in initdb.sh */ + /* this had better match pg_locks view in system_views.sql */ tupdesc = CreateTemplateTupleDesc(6, false); TupleDescInitEntry(tupdesc, (AttrNumber) 1, "relation", - OIDOID, -1, 0, false); + OIDOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "database", - OIDOID, -1, 0, false); + OIDOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 3, "transaction", - XIDOID, -1, 0, false); + XIDOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 4, "pid", - INT4OID, -1, 0, false); + INT4OID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 5, "mode", - TEXTOID, -1, 0, false); + TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 6, "granted", - BOOLOID, -1, 0, false); + BOOLOID, -1, 0); - funcctx->slot = TupleDescGetSlot(tupdesc); + funcctx->tuple_desc = BlessTupleDesc(tupdesc); /* * Collect all the locking information that we will format and @@ -173,9 +173,8 @@ pg_lock_status(PG_FUNCTION_ARGS) CStringGetDatum(GetLockmodeName(mode))); values[5] = BoolGetDatum(granted); - tuple = heap_formtuple(funcctx->slot->ttc_tupleDescriptor, - values, nulls); - result = TupleGetDatum(funcctx->slot, tuple); + tuple = heap_formtuple(funcctx->tuple_desc, values, nulls); + result = HeapTupleGetDatum(tuple); SRF_RETURN_NEXT(funcctx, result); } -- cgit v1.2.3