postgresql/src
Tom Lane 305cf1fd72 Fix AggGetAggref() so it won't lie to aggregate final functions.
If we merge the transition calculations for two different aggregates,
it's reasonable to assume that the transition function should not care
which of those Aggref structs it gets from AggGetAggref().  It is not
reasonable to make the same assumption about an aggregate final function,
however.  Commit 804163bc2 broke this, as it will pass whichever Aggref
was first associated with the transition state in both cases.

This doesn't create an observable bug so far as the core system is
concerned, because the only existing uses of AggGetAggref() are in
ordered-set aggregates that happen to not pay attention to anything
but the input properties of the Aggref; and besides that, we disabled
sharing of transition calculations for OSAs yesterday.  Nonetheless,
if some third-party code were using AggGetAggref() in a normal aggregate,
they would be entitled to call this a bug.  Hence, back-patch the fix
to 9.6 where the problem was introduced.

In passing, improve some of the comments about transition state sharing.

Discussion: https://postgr.es/m/CAB4ELO5RZhOamuT9Xsf72ozbenDLLXZKSk07FiSVsuJNZB861A@mail.gmail.com
2017-10-12 15:20:16 -04:00
..
backend Fix AggGetAggref() so it won't lie to aggregate final functions. 2017-10-12 15:20:16 -04:00
bin #ifdef out some dead code in psql/mainloop.c. 2017-10-06 11:35:55 -04:00
common Rewrite strnlen replacement implementation from 8a241792f9. 2017-10-10 14:50:30 -07:00
fe_utils Provide a test for variable existence in psql 2017-09-21 19:02:23 -04:00
include Fix AggGetAggref() so it won't lie to aggregate final functions. 2017-10-12 15:20:16 -04:00
interfaces Add port/strnlen support to libpq and ecpg Makefiles. 2017-10-11 11:28:04 -04:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:55 -04:00
pl Use Py_RETURN_NONE where suitable 2017-09-29 16:51:39 -04:00
port Rewrite strnlen replacement implementation from 8a241792f9. 2017-10-10 14:50:30 -07:00
template Remove "sco" and "unixware" ports. 2016-10-11 11:26:04 -04:00
test Synchronize error messages. 2017-10-12 15:14:22 -04:00
timezone Sync our copy of the timezone library with IANA tzcode master. 2017-09-22 00:04:29 -04:00
tools Enforce our convention about max number of parallel regression tests. 2017-10-07 17:20:09 -04:00
tutorial Distinguish selectivity of < from <= and > from >=. 2017-09-13 11:12:39 -04:00
.gitignore
DEVELOPERS
Makefile Remove redundant coverage target 2017-02-17 08:56:57 -05:00
Makefile.global.in Support coverage on vpath builds 2017-10-06 11:39:46 -04:00
Makefile.shlib Remove support for bcc and msvc standalone libpq builds 2017-04-11 15:22:21 +02:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00