Commit 0c444a7
committed
Simplify PathKey checking code
pathkeys_useful_for_ordering() contained some needless checks to return
0 when either root->query_pathkeys or pathkeys lists were empty. This is
already handled by pathkeys_count_contained_in(), so let's have it do the
work instead of having redundant checks.
Similarly, in pathkeys_useful_for_grouping(), checking pathkeys is an
empty list just before looping over it isn't required. Technically,
neither is the list empty check for group_pathkeys, but I felt a bit
more work would have to be done to get the equivalent behavior if we'd
left it up to the foreach loop to call list_member_ptr().
This was noticed by Andy while he was reviewing a patch to improve the
UNION planner. Since that patch adds another function similar to
pathkeys_useful_for_ordering() and since I wasn't planning to copy these
redundant checks over to the new function, let's adjust the existing
code so that both functions will be consistent.
Author: Andy Fan
Discussion: https://postgr.es/m/87o7cti48f.fsf@163.com1 parent 87027cb commit 0c444a7
1 file changed
+0
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2143 | 2143 | | |
2144 | 2144 | | |
2145 | 2145 | | |
2146 | | - | |
2147 | | - | |
2148 | | - | |
2149 | | - | |
2150 | | - | |
2151 | | - | |
2152 | 2146 | | |
2153 | 2147 | | |
2154 | 2148 | | |
| |||
2184 | 2178 | | |
2185 | 2179 | | |
2186 | 2180 | | |
2187 | | - | |
2188 | | - | |
2189 | | - | |
2190 | | - | |
2191 | 2181 | | |
2192 | 2182 | | |
2193 | 2183 | | |
| |||
0 commit comments