]> granicus.if.org Git - postgresql/commitdiff
Fix bug in aggregate (de)serialization commit.
authorRobert Haas <rhaas@postgresql.org>
Tue, 29 Mar 2016 19:21:57 +0000 (15:21 -0400)
committerRobert Haas <rhaas@postgresql.org>
Tue, 29 Mar 2016 19:21:57 +0000 (15:21 -0400)
resulttypeLen and resulttypeByVal must be set correctly when serializing
aggregates, not just when finalizing them.  This was in David's final
patch but I downloaded the wrong version by mistake and failed to spot
the error.

David Rowley

src/backend/executor/nodeAgg.c

index aba54195a30ef6f449439abb8b4c8110c3e4cc10..614b26b8e3cc88ca286b90f671238d98303b3fbf 100644 (file)
@@ -2862,11 +2862,10 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
                        fmgr_info_set_expr((Node *) finalfnexpr, &peragg->finalfn);
                }
 
-               /* when finalizing we get info about the final result's datatype */
-               if (aggstate->finalizeAggs)
-                       get_typlenbyval(aggref->aggtype,
-                                                       &peragg->resulttypeLen,
-                                                       &peragg->resulttypeByVal);
+               /* get info about the output value's datatype */
+               get_typlenbyval(aggref->aggoutputtype,
+                                               &peragg->resulttypeLen,
+                                               &peragg->resulttypeByVal);
 
                /*
                 * initval is potentially null, so don't try to access it as a struct