postgresql/src/backend
Tom Lane 616be05dfe Fix improper repetition of previous results from a hashed aggregate.
ExecReScanAgg's check for whether it could re-use a previously calculated
hashtable neglected the possibility that the Agg node might reference
PARAM_EXEC Params that are not referenced by its input plan node.  That's
okay if the Params are in upper tlist or qual expressions; but if one
appears in aggregate input expressions, then the hashtable contents need
to be recomputed when the Param's value changes.

To avoid unnecessary performance degradation in the case of a Param that
isn't within an aggregate input, add logic to the planner to determine
which Params are within aggregate inputs.  This requires a new field in
struct Agg, but fortunately we never write plans to disk, so this isn't
an initdb-forcing change.

Per report from Jeevan Chalke.  This has been broken since forever,
so back-patch to all supported branches.

Andrew Gierth, with minor adjustments by me

Report: <CAM2+6=VY8ykfLT5Q8vb9B6EbeBk-NGuLbT6seaQ+Fq4zXvrDcA@mail.gmail.com>
2016-08-24 14:38:13 -04:00
..
access Suppress compiler warnings in non-cassert builds. 2016-08-23 23:21:22 -04:00
bootstrap Revert CREATE INDEX ... INCLUDING ... 2016-04-08 21:52:13 +03:00
catalog Add SQL-accessible functions for inspecting index AM properties. 2016-08-13 18:31:14 -04:00
commands Final pgindent + perltidy run for 9.6. 2016-08-15 13:42:51 -04:00
executor Fix improper repetition of previous results from a hashed aggregate. 2016-08-24 14:38:13 -04:00
foreign Remove GetUserMappingId() and GetUserMappingById(). 2016-07-22 11:32:23 -04:00
lib Remove mergeHyperLogLog. 2016-04-27 10:55:32 -04:00
libpq Don't CHECK_FOR_INTERRUPTS between WaitLatch and ResetLatch. 2016-08-01 15:13:53 -04:00
main Repair a bit of pgindent damage. 2016-06-09 18:09:17 -04:00
nodes Fix improper repetition of previous results from a hashed aggregate. 2016-08-24 14:38:13 -04:00
optimizer Fix improper repetition of previous results from a hashed aggregate. 2016-08-24 14:38:13 -04:00
parser Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
po Translation updates 2016-08-08 11:08:00 -04:00
port pgindent run for 9.6 2016-06-09 18:02:36 -04:00
postmaster Fix bogus coding in WaitForBackgroundWorkerShutdown(). 2016-08-04 16:06:14 -04:00
regex Suppress compiler warnings about useless comparison of unsigned to zero. 2016-02-15 17:12:16 -05:00
replication reorderbuffer: preserve errno while reporting error 2016-08-19 14:38:55 -03:00
rewrite pgindent run for 9.6 2016-06-09 18:02:36 -04:00
snowball Update copyright for 2016 2016-01-02 13:33:40 -05:00
storage Don't CHECK_FOR_INTERRUPTS between WaitLatch and ResetLatch. 2016-08-01 15:13:53 -04:00
tcop Fix TOAST access failure in RETURNING queries. 2016-08-07 17:46:08 -04:00
tsearch Final pgindent + perltidy run for 9.6. 2016-08-15 13:42:51 -04:00
utils Suppress compiler warnings in non-cassert builds. 2016-08-23 23:21:22 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile Provide and use a makefile target to build all generated headers. 2016-07-01 15:09:02 -04:00
nls.mk Remove trailing slashes from directories in find command 2015-09-18 22:06:54 -04:00