pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix incorrect handling of polymorphic aggregates used as window
Date: Sun, 09 Oct 2016 16:49:47 +0000
Message-ID: <E1btHIJ-0002Zw-E3@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

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>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ac4a9d92fcb6869e757cc729dca2ca5ccf94b185

Modified Files
--------------
src/backend/executor/nodeWindowAgg.c       |  2 +-
src/test/regress/expected/polymorphism.out | 55 ++++++++++++++++++++++++++++++
src/test/regress/sql/polymorphism.sql      | 22 ++++++++++++
3 files changed, 78 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (2+ messages)  latest in thread

Message-ID: <E1btHIJ-0002Zw-E3@gemulon.postgresql.org>
Permalink:  ../E1btHIJ-0002Zw-E3@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1btHIJ-0002Zw-E3@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix incorrect handling of polymorphic aggregates used as window
  In-Reply-To: <E1btHIJ-0002Zw-E3@gemulon.postgresql.org>
  References: <E1btHIJ-0002Zw-E3@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox