Commit 2e27d4c
committed
Fix ORDER BY lost after AQUMV join rewrite
The rewrite cleared sortClause, so grouping_planner() skipped adding
a Sort node — queries with ORDER BY returned unsorted results from
the MV scan.
Fix: preserve sortClause and copy ressortgroupref to rewritten target
entries so the upper planner generates Sort correctly.
Before: Limit -> Gather -> Limit -> Seq Scan on mv
After: Limit -> Gather -> Limit -> Sort -> Seq Scan on mv1 parent e9abbe0 commit 2e27d4c
File tree
2 files changed
+17
-10
lines changed- src
- backend/optimizer/plan
- test/regress/expected
2 files changed
+17
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1206 | 1206 | | |
1207 | 1207 | | |
1208 | 1208 | | |
| 1209 | + | |
1209 | 1210 | | |
1210 | 1211 | | |
1211 | 1212 | | |
| |||
1243 | 1244 | | |
1244 | 1245 | | |
1245 | 1246 | | |
1246 | | - | |
| 1247 | + | |
1247 | 1248 | | |
1248 | 1249 | | |
1249 | 1250 | | |
1250 | | - | |
| 1251 | + | |
1251 | 1252 | | |
1252 | 1253 | | |
1253 | 1254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2077 | 2077 | | |
2078 | 2078 | | |
2079 | 2079 | | |
2080 | | - | |
2081 | | - | |
| 2080 | + | |
| 2081 | + | |
2082 | 2082 | | |
2083 | 2083 | | |
| 2084 | + | |
2084 | 2085 | | |
2085 | | - | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
2086 | 2089 | | |
2087 | | - | |
| 2090 | + | |
2088 | 2091 | | |
2089 | 2092 | | |
2090 | 2093 | | |
| |||
2138 | 2141 | | |
2139 | 2142 | | |
2140 | 2143 | | |
2141 | | - | |
2142 | | - | |
| 2144 | + | |
| 2145 | + | |
2143 | 2146 | | |
2144 | 2147 | | |
| 2148 | + | |
2145 | 2149 | | |
2146 | | - | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
2147 | 2153 | | |
2148 | | - | |
| 2154 | + | |
2149 | 2155 | | |
2150 | 2156 | | |
2151 | 2157 | | |
| |||
0 commit comments