]> granicus.if.org Git - postgresql/commit
Fix incorrect handling of polymorphic aggregates used as window functions.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 9 Oct 2016 16:49:37 +0000 (12:49 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 9 Oct 2016 16:49:37 +0000 (12:49 -0400)
commitdca25c2562199ce1e7e26367613912a8eadbbde8
treee3b7e6cc7cf315475de57698d837cc46a03d4258
parentb605aeba0e117e4b8087fc95eba4cce07bb185ef
Fix incorrect handling of polymorphic aggregates used as window functions.

The transfunction was told that its first argument and result were
of the window function output type, not the aggregate state type.
This'd only matter if the transfunction consults get_fn_expr_argtype,
which typically only polymorphic functions would do.

Although we have several regression tests around polymorphic aggs,
none of them detected this mistake --- in fact, they still didn't
fail when I injected the same mistake into nodeAgg.c.  So add some
more tests covering both plain agg and window-function-agg cases.

Per report from Sebastian Luque.  Back-patch to 9.6 where the error
was introduced (by sloppy refactoring in commit 804163bc2, looks like).

Report: <87int2qkat.fsf@gmail.com>
src/backend/executor/nodeWindowAgg.c
src/test/regress/expected/polymorphism.out
src/test/regress/sql/polymorphism.sql