summaryrefslogtreecommitdiff
path: root/src/backend/catalog/pg_aggregate.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-01-15 22:43:25 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-01-15 22:43:25 +0000
commit584e646ad886ab53d23d268bbf62f56882f0bb4e (patch)
tree666dc7068b4e2d62ddb25bad18cdedb2dcc01b04 /src/backend/catalog/pg_aggregate.c
parent0f4a58682153844419b3922f6524bc198135491e (diff)
downloadpostgresql-584e646ad886ab53d23d268bbf62f56882f0bb4e.tar.gz
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().
Diffstat (limited to 'src/backend/catalog/pg_aggregate.c')
-rw-r--r--src/backend/catalog/pg_aggregate.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c
index 7a5377fd03..cf338742c9 100644
--- a/src/backend/catalog/pg_aggregate.c
+++ b/src/backend/catalog/pg_aggregate.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.27 2000/01/10 17:14:31 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.28 2000/01/15 22:43:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -262,7 +262,9 @@ AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool *isNull)
HeapTuple tup;
Relation aggRel;
int initValAttno;
- Oid transtype;
+ Oid transtype,
+ typinput,
+ typelem;
text *textInitVal;
char *strInitVal,
*initVal;
@@ -320,7 +322,11 @@ AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool *isNull)
pfree(strInitVal);
elog(ERROR, "AggNameGetInitVal: cache lookup failed on aggregate transition function return type");
}
- initVal = fmgr(((Form_pg_type) GETSTRUCT(tup))->typinput, strInitVal, -1);
+ typinput = ((Form_pg_type) GETSTRUCT(tup))->typinput;
+ typelem = ((Form_pg_type) GETSTRUCT(tup))->typelem;
+
+ initVal = fmgr(typinput, strInitVal, typelem, -1);
+
pfree(strInitVal);
return initVal;
}