forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6a75562
committed
Get rid of multiple applications of transformExpr() to the same tree.
transformExpr() has for many years had provisions to do nothing whenapplied to an already-transformed expression tree. However, this wasalways ugly and of dubious reliability, so we'd be much better off withoutit. The primary historical reason for it was that gram.y sometimesreturned multiple links to the same subexpression, which is no longer trueas of my BETWEEN fixes. We'd also grown some lazy hacks in CREATE TABLELIKE (failing to distinguish between raw and already-transformed indexspecifications) and one or two other places.This patch removes the need for and support for re-transforming alreadytransformed expressions. The index case is dealt with by adding a flagto struct IndexStmt to indicate that it's already been transformed;which has some benefit anyway in that tablecmds.c can now Assert thattransformation has happened rather than just assuming. The other mainreason was some rather sloppy code for array type coercion, which canbe fixed (and its performance improved too) by refactoring.I did leave transformJoinUsingClause() still constructing expressionscontaining untransformed operator nodes being applied to Vars, so thattransformExpr() still has to allow Var inputs. But that's a much narrower,and safer, special case than before, since Vars will never appear in a rawparse tree, and they don't have any substructure to worry about.In passing fix some oversights in the patch that added CREATE INDEXIF NOT EXISTS (missing processing of IndexStmt.if_not_exists). Theseappear relatively harmless, but still sloppy coding practice.1 parent34af082 commit6a75562
File tree
10 files changed
+83
-116
lines changed- src
- backend
- bootstrap
- commands
- nodes
- parser
- include/nodes
10 files changed
+83
-116
lines changedLines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
304 | 304 |
| |
305 | 305 |
| |
306 | 306 |
| |
| 307 | + | |
307 | 308 |
| |
| 309 | + | |
308 | 310 |
| |
309 | 311 |
| |
310 | 312 |
| |
| |||
345 | 347 |
| |
346 | 348 |
| |
347 | 349 |
| |
| 350 | + | |
348 | 351 |
| |
| 352 | + | |
349 | 353 |
| |
350 | 354 |
| |
351 | 355 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5705 | 5705 |
| |
5706 | 5706 |
| |
5707 | 5707 |
| |
| 5708 | + | |
| 5709 | + | |
| 5710 | + | |
5708 | 5711 |
| |
5709 | 5712 |
| |
5710 | 5713 |
| |
5711 | 5714 |
| |
5712 | 5715 |
| |
5713 | 5716 |
| |
5714 | 5717 |
| |
5715 |
| - | |
5716 |
| - | |
5717 | 5718 |
| |
5718 | 5719 |
| |
5719 | 5720 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2937 | 2937 |
| |
2938 | 2938 |
| |
2939 | 2939 |
| |
| 2940 | + | |
2940 | 2941 |
| |
2941 | 2942 |
| |
2942 | 2943 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1209 | 1209 |
| |
1210 | 1210 |
| |
1211 | 1211 |
| |
| 1212 | + | |
1212 | 1213 |
| |
1213 | 1214 |
| |
1214 | 1215 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2078 | 2078 |
| |
2079 | 2079 |
| |
2080 | 2080 |
| |
| 2081 | + | |
2081 | 2082 |
| |
| 2083 | + | |
2082 | 2084 |
| |
2083 | 2085 |
| |
2084 | 2086 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6563 | 6563 |
| |
6564 | 6564 |
| |
6565 | 6565 |
| |
| 6566 | + | |
6566 | 6567 |
| |
6567 | 6568 |
| |
6568 | 6569 |
| |
| |||
6588 | 6589 |
| |
6589 | 6590 |
| |
6590 | 6591 |
| |
| 6592 | + | |
6591 | 6593 |
| |
6592 | 6594 |
| |
6593 | 6595 |
| |
|
Lines changed: 5 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
339 | 339 |
| |
340 | 340 |
| |
341 | 341 |
| |
342 |
| - | |
343 |
| - | |
344 |
| - | |
345 |
| - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
346 | 347 |
| |
347 | 348 |
| |
348 | 349 |
| |
|
Lines changed: 53 additions & 110 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
84 |
| - | |
85 |
| - | |
86 |
| - | |
87 |
| - | |
88 |
| - | |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
105 |
| - | |
| 84 | + | |
| 85 | + | |
106 | 86 |
| |
107 | 87 |
| |
108 | 88 |
| |
| |||
168 | 148 |
| |
169 | 149 |
| |
170 | 150 |
| |
171 |
| - | |
172 |
| - | |
173 |
| - | |
174 |
| - | |
175 |
| - | |
176 |
| - | |
177 |
| - | |
178 |
| - | |
179 |
| - | |
180 |
| - | |
181 |
| - | |
182 |
| - | |
183 |
| - | |
184 |
| - | |
185 |
| - | |
186 |
| - | |
187 |
| - | |
188 |
| - | |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 |
| - | |
193 |
| - | |
194 |
| - | |
195 |
| - | |
196 |
| - | |
197 |
| - | |
198 |
| - | |
199 |
| - | |
200 |
| - | |
201 |
| - | |
202 |
| - | |
203 |
| - | |
204 |
| - | |
205 |
| - | |
206 |
| - | |
207 |
| - | |
208 |
| - | |
209 |
| - | |
210 |
| - | |
211 |
| - | |
212 |
| - | |
| 151 | + | |
| 152 | + | |
213 | 153 |
| |
214 | 154 |
| |
215 | 155 |
| |
| |||
324 | 264 |
| |
325 | 265 |
| |
326 | 266 |
| |
327 |
| - | |
328 |
| - | |
329 |
| - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
330 | 270 |
| |
331 |
| - | |
332 |
| - | |
333 |
| - | |
334 |
| - | |
335 |
| - | |
336 |
| - | |
337 |
| - | |
338 |
| - | |
339 |
| - | |
340 |
| - | |
341 |
| - | |
342 |
| - | |
343 |
| - | |
344 |
| - | |
345 |
| - | |
346 |
| - | |
347 |
| - | |
348 |
| - | |
349 |
| - | |
350 |
| - | |
351 |
| - | |
352 |
| - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
353 | 277 |
| |
354 |
| - | |
355 |
| - | |
356 |
| - | |
357 | 278 |
| |
| 279 | + | |
358 | 280 |
| |
359 | 281 |
| |
360 | 282 |
| |
| |||
1461 | 1383 |
| |
1462 | 1384 |
| |
1463 | 1385 |
| |
1464 |
| - | |
1465 |
| - | |
1466 |
| - | |
1467 |
| - | |
1468 | 1386 |
| |
1469 | 1387 |
| |
1470 | 1388 |
| |
| |||
1592 | 1510 |
| |
1593 | 1511 |
| |
1594 | 1512 |
| |
1595 |
| - | |
1596 |
| - | |
1597 |
| - | |
1598 |
| - | |
1599 | 1513 |
| |
1600 | 1514 |
| |
1601 | 1515 |
| |
| |||
1964 | 1878 |
| |
1965 | 1879 |
| |
1966 | 1880 |
| |
1967 |
| - | |
1968 |
| - | |
1969 |
| - | |
1970 |
| - | |
1971 | 1881 |
| |
1972 | 1882 |
| |
1973 | 1883 |
| |
| |||
2074 | 1984 |
| |
2075 | 1985 |
| |
2076 | 1986 |
| |
2077 |
| - | |
2078 |
| - | |
2079 |
| - | |
2080 |
| - | |
2081 | 1987 |
| |
2082 | 1988 |
| |
2083 | 1989 |
| |
| |||
2381 | 2287 |
| |
2382 | 2288 |
| |
2383 | 2289 |
| |
2384 |
| - | |
2385 |
| - | |
| 2290 | + | |
| 2291 | + | |
2386 | 2292 |
| |
2387 | 2293 |
| |
2388 | 2294 |
| |
2389 | 2295 |
| |
2390 | 2296 |
| |
2391 | 2297 |
| |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
2392 | 2335 |
| |
2393 | 2336 |
| |
2394 | 2337 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1072 | 1072 |
| |
1073 | 1073 |
| |
1074 | 1074 |
| |
| 1075 | + | |
1075 | 1076 |
| |
| 1077 | + | |
1076 | 1078 |
| |
1077 | 1079 |
| |
1078 | 1080 |
| |
| |||
1530 | 1532 |
| |
1531 | 1533 |
| |
1532 | 1534 |
| |
| 1535 | + | |
1533 | 1536 |
| |
| 1537 | + | |
1534 | 1538 |
| |
1535 | 1539 |
| |
1536 | 1540 |
| |
| |||
1941 | 1945 |
| |
1942 | 1946 |
| |
1943 | 1947 |
| |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
1944 | 1952 |
| |
1945 | 1953 |
| |
1946 | 1954 |
| |
| |||
2021 | 2029 |
| |
2022 | 2030 |
| |
2023 | 2031 |
| |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
2024 | 2035 |
| |
2025 | 2036 |
| |
2026 | 2037 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2261 | 2261 |
| |
2262 | 2262 |
| |
2263 | 2263 |
| |
| 2264 | + | |
2264 | 2265 |
| |
2265 | 2266 |
| |
2266 | 2267 |
| |
|
0 commit comments
Comments
(0)