Re: Error from array_agg when table has many rows
От | Tom Lane |
---|---|
Тема | Re: Error from array_agg when table has many rows |
Дата | |
Msg-id | 1297401.1741449001@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Error from array_agg when table has many rows (Richard Guo <guofenglinux@gmail.com>) |
Ответы |
Re: Error from array_agg when table has many rows
|
Список | pgsql-bugs |
Richard Guo <guofenglinux@gmail.com> writes: > We are performing deserialization during the final phase of the > aggregation on data of type RECORD but we fail to provide a valid > typmod (array_agg_deserialize() uses -1 as the typmod when calling the > receiveproc). > I haven't verified it, but I suspect it's related to 16fd03e95. Yeah. I don't think there is any way for array_agg_deserialize to know the correct typmod, so what we have to do is disable using partial aggregation in this case. Fortunately there's a policy-setting function that can be taught that, as attached. regards, tom lane diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c index 9e567f3cc45..0ac8966e30f 100644 --- a/src/backend/parser/parse_agg.c +++ b/src/backend/parser/parse_agg.c @@ -2052,7 +2052,7 @@ resolve_aggregate_transtype(Oid aggfuncid, /* * agg_args_support_sendreceive - * Returns true if all non-byval of aggref's arg types have send and + * Returns true if all non-byval types of aggref's args have send and * receive functions. */ bool @@ -2067,6 +2067,15 @@ agg_args_support_sendreceive(Aggref *aggref) TargetEntry *tle = (TargetEntry *) lfirst(lc); Oid type = exprType((Node *) tle->expr); + /* + * RECORD is a special case: it has typsend/typreceive functions, but + * record_recv only works if passed the correct typmod to identify the + * specific anonymous record type. array_agg_deserialize cannot do + * that, so we have to disclaim support for the case. + */ + if (type == RECORDOID) + return false; + typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type)); if (!HeapTupleIsValid(typeTuple)) elog(ERROR, "cache lookup failed for type %u", type);
В списке pgsql-bugs по дате отправления: