From 584e646ad886ab53d23d268bbf62f56882f0bb4e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 15 Jan 2000 22:43:25 +0000 Subject: Fix a passel of problems with incorrect calls to typinput and typoutput functions, which would lead to trouble with datatypes that paid attention to the typelem or typmod parameters to these functions. In particular, incorrect code in pg_aggregate.c explains the platform-specific failures that have been reported in NUMERIC avg(). --- src/backend/utils/adt/selfuncs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/backend/utils/adt/selfuncs.c') diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index b711d768c07..7ec3e4dc1b8 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.47 2000/01/15 02:59:38 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.48 2000/01/15 22:43:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -600,6 +600,7 @@ getattstatistics(Oid relid, AttrNumber attnum, Oid opid, Oid typid, HeapTuple tuple; HeapTuple typeTuple; FmgrInfo inputproc; + Oid typelem; rel = heap_openr(StatisticRelationName, AccessShareLock); @@ -630,6 +631,7 @@ getattstatistics(Oid relid, AttrNumber attnum, Oid opid, Oid typid, elog(ERROR, "getattstatistics: Cache lookup failed for type %u", typid); fmgr_info(((Form_pg_type) GETSTRUCT(typeTuple))->typinput, &inputproc); + typelem = ((Form_pg_type) GETSTRUCT(typeTuple))->typelem; /* Values are variable-length fields, so cannot access as struct fields. * Must do it the hard way with heap_getattr. @@ -649,7 +651,7 @@ getattstatistics(Oid relid, AttrNumber attnum, Oid opid, Oid typid, { char *strval = textout(val); *commonval = (Datum) - (*fmgr_faddr(&inputproc)) (strval, typid, typmod); + (*fmgr_faddr(&inputproc)) (strval, typelem, typmod); pfree(strval); } } @@ -669,7 +671,7 @@ getattstatistics(Oid relid, AttrNumber attnum, Oid opid, Oid typid, { char *strval = textout(val); *loval = (Datum) - (*fmgr_faddr(&inputproc)) (strval, typid, typmod); + (*fmgr_faddr(&inputproc)) (strval, typelem, typmod); pfree(strval); } } @@ -689,7 +691,7 @@ getattstatistics(Oid relid, AttrNumber attnum, Oid opid, Oid typid, { char *strval = textout(val); *hival = (Datum) - (*fmgr_faddr(&inputproc)) (strval, typid, typmod); + (*fmgr_faddr(&inputproc)) (strval, typelem, typmod); pfree(strval); } } -- cgit v1.2.3