forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2591ee8
committed
Fix assorted missing logic for GroupingFunc nodes.
The planner needs to treat GroupingFunc like Aggref for many purposes,in particular with respect to processing of the argument expressions,which are not to be evaluated at runtime. A few places hadn't gottenthat memo, notably including subselect.c's processing of outer-levelaggregates. This resulted in assertion failures or wrong plans forcases in which a GROUPING() construct references an outer aggregationlevel.Also fix missing special cases for GroupingFunc in cost_qual_eval(resulting in wrong cost estimates for GROUPING(), although it'snot clear that that would affect plan shapes in practice) and inruleutils.c (resulting in excess parentheses in pretty-print mode).Per bug #17088 from Yaoguang Chen. Back-patch to all supportedbranches.Richard Guo, Tom LaneDiscussion:https://postgr.es/m/17088-e33882b387de7f5c@postgresql.org1 parent1361959 commit2591ee8
File tree
6 files changed
+88
-14
lines changed- src
- backend
- nodes
- optimizer
- path
- plan
- utils/adt
- test/regress
- expected
- sql
6 files changed
+88
-14
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
736 | 736 |
| |
737 | 737 |
| |
738 | 738 |
| |
| 739 | + | |
| 740 | + | |
739 | 741 |
| |
740 | 742 |
| |
741 | 743 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4492 | 4492 |
| |
4493 | 4493 |
| |
4494 | 4494 |
| |
| 4495 | + | |
| 4496 | + | |
| 4497 | + | |
| 4498 | + | |
| 4499 | + | |
| 4500 | + | |
4495 | 4501 |
| |
4496 | 4502 |
| |
4497 | 4503 |
| |
|
Lines changed: 19 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
356 | 356 |
| |
357 | 357 |
| |
358 | 358 |
| |
359 |
| - | |
360 |
| - | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
361 | 362 |
| |
362 |
| - | |
363 |
| - | |
364 |
| - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
365 | 366 |
| |
366 | 367 |
| |
367 |
| - | |
| 368 | + | |
| 369 | + | |
368 | 370 |
| |
369 | 371 |
| |
370 | 372 |
| |
| |||
1957 | 1959 |
| |
1958 | 1960 |
| |
1959 | 1961 |
| |
1960 |
| - | |
1961 |
| - | |
1962 |
| - | |
1963 |
| - | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
1964 | 1967 |
| |
1965 | 1968 |
| |
1966 | 1969 |
| |
| |||
1972 | 1975 |
| |
1973 | 1976 |
| |
1974 | 1977 |
| |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
1975 | 1983 |
| |
1976 | 1984 |
| |
1977 | 1985 |
| |
| |||
2084 | 2092 |
| |
2085 | 2093 |
| |
2086 | 2094 |
| |
2087 |
| - | |
| 2095 | + | |
2088 | 2096 |
| |
2089 | 2097 |
| |
2090 | 2098 |
| |
|
Lines changed: 7 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7956 | 7956 |
| |
7957 | 7957 |
| |
7958 | 7958 |
| |
7959 |
| - | |
7960 |
| - | |
7961 |
| - | |
| 7959 | + | |
| 7960 | + | |
| 7961 | + | |
7962 | 7962 |
| |
7963 | 7963 |
| |
7964 | 7964 |
| |
| 7965 | + | |
7965 | 7966 |
| |
7966 | 7967 |
| |
7967 | 7968 |
| |
| |||
8089 | 8090 |
| |
8090 | 8091 |
| |
8091 | 8092 |
| |
| 8093 | + | |
8092 | 8094 |
| |
8093 | 8095 |
| |
8094 | 8096 |
| |
| |||
8205 | 8207 |
| |
8206 | 8208 |
| |
8207 | 8209 |
| |
| 8210 | + | |
8208 | 8211 |
| |
8209 | 8212 |
| |
8210 | 8213 |
| |
| |||
8255 | 8258 |
| |
8256 | 8259 |
| |
8257 | 8260 |
| |
| 8261 | + | |
8258 | 8262 |
| |
8259 | 8263 |
| |
8260 | 8264 |
| |
|
Lines changed: 45 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2042 | 2042 |
| |
2043 | 2043 |
| |
2044 | 2044 |
| |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
2045 | 2090 |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
557 | 557 |
| |
558 | 558 |
| |
559 | 559 |
| |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
560 | 569 |
|
0 commit comments
Comments
(0)