- Notifications
You must be signed in to change notification settings - Fork28
Commit7e5e8b3
committed
Fix crash when columns have been added to the end of a view.
expandRTE() supposed that an RTE_SUBQUERY subquery must have exactlyas many non-junk tlist items as the RTE has column aliases for it.This was true at the time the code was written, and is still true sofar as parse analysis is concerned --- but when the function is usedduring planning, the subquery might have appeared through insertionof a view that now has more columns than it did when the outer querywas parsed. This results in a core dump if, for instance, we haveto expand a whole-row Var that references the subquery.To avoid crashing, we can either stop expanding the RTE when we runout of aliases, or invent new aliases for the added columns. Whilethe latter might be more useful, the former is consistent with whatexpandRTE() does for composite-returning functions in the RTE_FUNCTIONcase, so it seems like we'd better do it that way.Per bug #14876 from Samuel Horwitz. This has been busted since commitff1ea21 allowed views to acquire more columns, so back-patch to allsupported branches.Discussion:https://postgr.es/m/20171026184035.1471.82810@wrigleys.postgresql.org1 parentcf0331a commit7e5e8b3
File tree
3 files changed
+116
-1
lines changed- src
- backend/parser
- test/regress
- expected
- sql
3 files changed
+116
-1
lines changedLines changed: 11 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2012 | 2012 |
| |
2013 | 2013 |
| |
2014 | 2014 |
| |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
2015 | 2026 |
| |
2016 | 2027 |
| |
2017 |
| - | |
2018 | 2028 |
| |
2019 | 2029 |
| |
2020 | 2030 |
| |
|
Lines changed: 85 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2156 | 2156 |
| |
2157 | 2157 |
| |
2158 | 2158 |
| |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
2159 | 2244 |
| |
2160 | 2245 |
| |
2161 | 2246 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1402 | 1402 |
| |
1403 | 1403 |
| |
1404 | 1404 |
| |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
1405 | 1425 |
| |
1406 | 1426 |
| |
1407 | 1427 |
| |
|
0 commit comments
Comments
(0)