postgresql/src
Tom Lane dfefe38fbe Fix assorted missing logic for GroupingFunc nodes.
The planner needs to treat GroupingFunc like Aggref for many purposes,
in particular with respect to processing of the argument expressions,
which are not to be evaluated at runtime.  A few places hadn't gotten
that memo, notably including subselect.c's processing of outer-level
aggregates.  This resulted in assertion failures or wrong plans for
cases in which a GROUPING() construct references an outer aggregation
level.

Also fix missing special cases for GroupingFunc in cost_qual_eval
(resulting in wrong cost estimates for GROUPING(), although it's
not clear that that would affect plan shapes in practice) and in
ruleutils.c (resulting in excess parentheses in pretty-print mode).

Per bug #17088 from Yaoguang Chen.  Back-patch to all supported
branches.

Richard Guo, Tom Lane

Discussion: https://postgr.es/m/17088-e33882b387de7f5c@postgresql.org
2022-03-21 17:44:29 -04:00
..
backend Fix assorted missing logic for GroupingFunc nodes. 2022-03-21 17:44:29 -04:00
bin Introduce PG_TEST_TIMEOUT_DEFAULT for TAP suite non-elapsing timeouts. 2022-03-04 18:53:17 -08:00
common Fix buffer overrun in unicode string normalization with empty input 2021-11-11 15:01:54 +09:00
fe_utils Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
include Fix waiting in RegisterSyncRequest(). 2022-03-16 15:37:15 +13:00
interfaces Fix pg_regress to print the correct postmaster address on Windows. 2022-03-04 13:23:58 -05:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Disallow execution of SPI functions during plperl function compilation. 2022-02-25 17:40:44 -05:00
port AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:28:02 -07:00
template Further tweaking of PG_SYSROOT heuristics for macOS. 2021-01-20 12:07:31 -05:00
test Fix assorted missing logic for GroupingFunc nodes. 2022-03-21 17:44:29 -04:00
timezone Update time zone data files to tzdata release 2021e. 2021-10-29 11:38:38 -04:00
tools Suppress warning about stack_base_ptr with late-model GCC. 2022-02-17 22:45:34 -05:00
tutorial tutorial: land height is "elevation", not "altitude" 2021-03-10 20:25:18 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Fix prove_installcheck to use correct paths when used with PGXS 2021-07-01 08:46:38 -04:00
Makefile.shlib AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:28:02 -07:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00