pgsql: Correctly set up aggregate FILTER expression in partial-aggregat
От
Tom Lane
Тема
pgsql: Correctly set up aggregate FILTER expression in
partial-aggregat
Дата
Msg-id
E1bR76Y-000319-H1@gemulon.postgresql.org
Список
Correctly set up aggregate FILTER expression in partial-aggregation plans. The aggfilter expression should be removed from the parent (combining) Aggref, since it's not supposed to apply the filter, and indeed cannot because any Vars used in the filter would not be available after the lower-level aggregation step. Per report from Jeff Janes. (This has been broken since the introduction of partial aggregation, I think. The error became obvious after commit 59a3795c2, when setrefs.c began processing the parent Aggref's fields normally and thus would detect such Vars. The special-case coding previously used in setrefs.c skipped over the parent's aggfilter field without processing it. That was broken in its own way because no other setrefs.c processing got applied either; though since the executor would not execute the filter expression, only initialize it, that oversight might not have had any visible symptoms at present.) Report: Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/6d85bb1ba79c2792214df9fa17bcc8fac229c11c Modified Files -------------- src/backend/optimizer/plan/setrefs.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
В списке pgsql-committers по дате отправления
От: Noah Misch
Дата: