postgresql/src/backend
Tom Lane 2c00fad286 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:12 -04:00
..
access Suppress compiler warnings in non-cassert builds. 2016-08-23 23:21:10 -04:00
bootstrap Revert CREATE INDEX ... INCLUDING ... 2016-04-08 21:52:13 +03:00
catalog Use LEFT JOINs in some system views in case referenced row doesn't exist. 2016-08-19 17:13:47 -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:12 -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 Remove duplicate function prototype. 2016-08-23 13:44:18 -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:12 -04:00
optimizer Fix improper repetition of previous results from a hashed aggregate. 2016-08-24 14:38:12 -04:00
parser Improve parsetree representation of special functions such as CURRENT_DATE. 2016-08-16 20:33:01 -04:00
po Translation updates 2016-08-08 11:08:00 -04:00
port Remove obsolete replacement system() on darwin 2016-08-18 12:00:00 -04:00
postmaster Refactor RandomSalt to handle salts of different lengths. 2016-08-18 13:41:17 +03:00
regex Clean up another pre-ANSI-C-ism in regex code: get rid of pcolor typedef. 2016-08-19 13:31:10 -04: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 Extend dsm API with a new function dsm_unpin_segment. 2016-08-23 14:32:23 -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:10 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Provide and use a makefile target to build all generated headers. 2016-07-01 15:09:02 -04:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
nls.mk Remove trailing slashes from directories in find command 2015-09-18 22:06:54 -04:00