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

Commit0c444a7

Browse files
committed
Simplify PathKey checking code
pathkeys_useful_for_ordering() contained some needless checks to return0 when either root->query_pathkeys or pathkeys lists were empty. This isalready handled by pathkeys_count_contained_in(), so let's have it do thework instead of having redundant checks.Similarly, in pathkeys_useful_for_grouping(), checking pathkeys is anempty list just before looping over it isn't required. Technically,neither is the list empty check for group_pathkeys, but I felt a bitmore work would have to be done to get the equivalent behavior if we'dleft it up to the foreach loop to call list_member_ptr().This was noticed by Andy while he was reviewing a patch to improve theUNION planner. Since that patch adds another function similar topathkeys_useful_for_ordering() and since I wasn't planning to copy theseredundant checks over to the new function, let's adjust the existingcode so that both functions will be consistent.Author: Andy FanDiscussion:https://postgr.es/m/87o7cti48f.fsf@163.com
1 parent87027cb commit0c444a7

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

‎src/backend/optimizer/path/pathkeys.c‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,12 +2143,6 @@ pathkeys_useful_for_ordering(PlannerInfo *root, List *pathkeys)
21432143
{
21442144
intn_common_pathkeys;
21452145

2146-
if (root->query_pathkeys==NIL)
2147-
return0;/* no special ordering requested */
2148-
2149-
if (pathkeys==NIL)
2150-
return0;/* unordered path */
2151-
21522146
(void)pathkeys_count_contained_in(root->query_pathkeys,pathkeys,
21532147
&n_common_pathkeys);
21542148

@@ -2184,10 +2178,6 @@ pathkeys_useful_for_grouping(PlannerInfo *root, List *pathkeys)
21842178
if (root->group_pathkeys==NIL)
21852179
return0;
21862180

2187-
/* unordered path */
2188-
if (pathkeys==NIL)
2189-
return0;
2190-
21912181
/* walk the pathkeys and search for matching group key */
21922182
foreach(key,pathkeys)
21932183
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp