From c541bb86e9ec8fed37b23df6a0df703d0bde4dfa Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 6 Jun 2004 00:41:28 +0000 Subject: Infrastructure for I/O of composite types: arrange for the I/O routines of a composite type to get that type's OID as their second parameter, in place of typelem which is useless. The actual changes are mostly centralized in getTypeInputInfo and siblings, but I had to fix a few places that were fetching pg_type.typelem for themselves instead of using the lsyscache.c routines. Also, I renamed all the related variables from 'typelem' to 'typioparam' to discourage people from assuming that they necessarily contain array element types. --- src/backend/executor/nodeAgg.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/backend/executor/nodeAgg.c') diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 265828f4c10..119f5da346c 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -45,7 +45,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.121 2004/05/30 23:40:26 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.122 2004/06/06 00:41:26 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1357,29 +1357,17 @@ ExecInitAgg(Agg *node, EState *estate) static Datum GetAggInitVal(Datum textInitVal, Oid transtype) { - char *strInitVal; - HeapTuple tup; Oid typinput, - typelem; + typioparam; + char *strInitVal; Datum initVal; + getTypeInputInfo(transtype, &typinput, &typioparam); strInitVal = DatumGetCString(DirectFunctionCall1(textout, textInitVal)); - - tup = SearchSysCache(TYPEOID, - ObjectIdGetDatum(transtype), - 0, 0, 0); - if (!HeapTupleIsValid(tup)) - elog(ERROR, "cache lookup failed for type %u", transtype); - - typinput = ((Form_pg_type) GETSTRUCT(tup))->typinput; - typelem = ((Form_pg_type) GETSTRUCT(tup))->typelem; - ReleaseSysCache(tup); - initVal = OidFunctionCall3(typinput, CStringGetDatum(strInitVal), - ObjectIdGetDatum(typelem), + ObjectIdGetDatum(typioparam), Int32GetDatum(-1)); - pfree(strInitVal); return initVal; } -- cgit v1.2.3