1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Allow aggregate transition states to be serialized and deserialized.

This is necessary infrastructure for supporting parallel aggregation
for aggregates whose transition type is "internal".  Such values
can't be passed between cooperating processes, because they are
just pointers.

David Rowley, reviewed by Tomas Vondra and by me.
This commit is contained in:
Robert Haas
2016-03-29 15:04:05 -04:00
parent 7f0a2c85fb
commit 5fe5a2cee9
25 changed files with 794 additions and 193 deletions

View File

@@ -464,11 +464,15 @@ aggregates_allow_partial_walker(Node *node, partial_agg_context *context)
}
/*
* If we find any aggs with an internal transtype then we must ensure
* that pointers to aggregate states are not passed to other processes;
* therefore, we set the maximum allowed type to PAT_INTERNAL_ONLY.
* If we find any aggs with an internal transtype then we must check
* that these have a serialization type, serialization func and
* deserialization func; otherwise, we set the maximum allowed type to
* PAT_INTERNAL_ONLY.
*/
if (aggform->aggtranstype == INTERNALOID)
if (aggform->aggtranstype == INTERNALOID &&
(!OidIsValid(aggform->aggserialtype) ||
!OidIsValid(aggform->aggserialfn) ||
!OidIsValid(aggform->aggdeserialfn)))
context->allowedtype = PAT_INTERNAL_ONLY;
ReleaseSysCache(aggTuple);