Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
7a8e9f29
Commit
7a8e9f29
authored
11 years ago
by
Noah Misch
Browse files
Options
Downloads
Patches
Plain Diff
Comment on why planagg.c punts "MIN(x ORDER BY y)".
parent
4a87f308
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/optimizer/plan/planagg.c
+16
-2
16 additions, 2 deletions
src/backend/optimizer/plan/planagg.c
with
16 additions
and
2 deletions
src/backend/optimizer/plan/planagg.c
+
16
−
2
View file @
7a8e9f29
...
@@ -314,15 +314,29 @@ find_minmax_aggs_walker(Node *node, List **context)
...
@@ -314,15 +314,29 @@ find_minmax_aggs_walker(Node *node, List **context)
ListCell
*
l
;
ListCell
*
l
;
Assert
(
aggref
->
agglevelsup
==
0
);
Assert
(
aggref
->
agglevelsup
==
0
);
if
(
list_length
(
aggref
->
args
)
!=
1
||
aggref
->
aggorder
!=
NIL
)
if
(
list_length
(
aggref
->
args
)
!=
1
)
return
true
;
/* it couldn't be MIN/MAX */
return
true
;
/* it couldn't be MIN/MAX */
/*
* ORDER BY is usually irrelevant for MIN/MAX, but it can change the
* outcome if the aggsortop's operator class recognizes non-identical
* values as equal. For example, 4.0 and 4.00 are equal according to
* numeric_ops, yet distinguishable. If MIN() receives more than one
* value equal to 4.0 and no value less than 4.0, it is unspecified
* which of those equal values MIN() returns. An ORDER BY expression
* that differs for each of those equal values of the argument
* expression makes the result predictable once again. This is a
* niche requirement, and we do not implement it with subquery paths.
*/
if
(
aggref
->
aggorder
!=
NIL
)
return
true
;
/* note: we do not care if DISTINCT is mentioned ... */
/* note: we do not care if DISTINCT is mentioned ... */
curTarget
=
(
TargetEntry
*
)
linitial
(
aggref
->
args
);
aggsortop
=
fetch_agg_sort_op
(
aggref
->
aggfnoid
);
aggsortop
=
fetch_agg_sort_op
(
aggref
->
aggfnoid
);
if
(
!
OidIsValid
(
aggsortop
))
if
(
!
OidIsValid
(
aggsortop
))
return
true
;
/* not a MIN/MAX aggregate */
return
true
;
/* not a MIN/MAX aggregate */
curTarget
=
(
TargetEntry
*
)
linitial
(
aggref
->
args
);
if
(
contain_mutable_functions
((
Node
*
)
curTarget
->
expr
))
if
(
contain_mutable_functions
((
Node
*
)
curTarget
->
expr
))
return
true
;
/* not potentially indexable */
return
true
;
/* not potentially indexable */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment