Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit61444bf

Browse files
committed
Allow to push down clauses from HAVING to WHERE when grouping sets are used.
Previously we disallowed pushing down quals to WHERE in the presence ofgrouping sets. That's overly restrictive.We now instead copy quals to WHERE if applicable, leaving theone in HAVING in place. That's because, at that stage of the planningprocess, it's nontrivial to determine if it's safe to remove the one inHAVING.Author: Andrew GierthDiscussion: 874mkt3l59.fsf@news-spur.riddles.org.ukBackpatch: 9.5, where grouping sets were introduced. This isn't exactly a bugfix, but it seems better to keep the branches in sync at this point.
1 parente6d8cb7 commit61444bf

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

‎src/backend/optimizer/plan/planner.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,13 +570,12 @@ subquery_planner(PlannerGlobal *glob, Query *parse,
570570

571571
if (contain_agg_clause(havingclause)||
572572
contain_volatile_functions(havingclause)||
573-
contain_subplans(havingclause)||
574-
parse->groupingSets)
573+
contain_subplans(havingclause))
575574
{
576575
/* keep it in HAVING */
577576
newHaving=lappend(newHaving,havingclause);
578577
}
579-
elseif (parse->groupClause)
578+
elseif (parse->groupClause&& !parse->groupingSets)
580579
{
581580
/* move it to WHERE */
582581
parse->jointree->quals= (Node*)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp