pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix sharing Agg transition state of DISTINCT or ordered aggs.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix sharing Agg transition state of DISTINCT or ordered aggs.
@ 2016-12-20 07:23  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2016-12-20 07:23 UTC (permalink / raw)
  To: pgsql-committers

Fix sharing Agg transition state of DISTINCT or ordered aggs.

If a query contained two aggregates that could share the transition value,
we would correctly collect the input into a tuplesort only once, but
incorrectly run the transition function over the accumulated input twice,
in finalize_aggregates(). That caused a crash, when we tried to call
tuplesort_performsort() on an already-freed NULL tuplestore.

Backport to 9.6, where sharing of transition state and this bug were
introduced.

Analysis by Tom Lane.

Discussion: https://www.postgresql.org/message-id/ac5b0b69-744c-9114-6218-8300ac920e61@iki.fi

Branch
------
master

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

Modified Files
--------------
src/backend/executor/nodeAgg.c           | 21 ++++++++++++++++++---
src/test/regress/expected/aggregates.out |  9 +++++++++
src/test/regress/sql/aggregates.sql      |  3 +++
3 files changed, 30 insertions(+), 3 deletions(-)


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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix sharing Agg transition state of DISTINCT or ordered aggs.
@ 2016-12-20 07:23  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2016-12-20 07:23 UTC (permalink / raw)
  To: pgsql-committers

Fix sharing Agg transition state of DISTINCT or ordered aggs.

If a query contained two aggregates that could share the transition value,
we would correctly collect the input into a tuplesort only once, but
incorrectly run the transition function over the accumulated input twice,
in finalize_aggregates(). That caused a crash, when we tried to call
tuplesort_performsort() on an already-freed NULL tuplestore.

Backport to 9.6, where sharing of transition state and this bug were
introduced.

Analysis by Tom Lane.

Discussion: https://www.postgresql.org/message-id/ac5b0b69-744c-9114-6218-8300ac920e61@iki.fi

Branch
------
REL9_6_STABLE

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

Modified Files
--------------
src/backend/executor/nodeAgg.c           | 21 ++++++++++++++++++---
src/test/regress/expected/aggregates.out |  9 +++++++++
src/test/regress/sql/aggregates.sql      |  3 +++
3 files changed, 30 insertions(+), 3 deletions(-)


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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-12-20 07:23 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-12-20 07:23 pgsql: Fix sharing Agg transition state of DISTINCT or ordered aggs. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2016-12-20 07:23 pgsql: Fix sharing Agg transition state of DISTINCT or ordered aggs. Heikki Linnakangas <heikki.linnakangas@iki.fi>

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