forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita874fe7
committed
Refactor the executor's API to support data-modifying CTEs better.
The originally committed patch for modifying CTEs didn't interact wellwith EXPLAIN, as noted by myself, and also had corner-case problems withtriggers, as noted by Dean Rasheed. Those problems show it is really notpractical for ExecutorEnd to call any user-defined code; so split thecleanup duties out into a new function ExecutorFinish, which must be calledbetween the last ExecutorRun call and ExecutorEnd. Some Asserts have beenadded to these functions to help verify correct usage.It is no longer necessary for callers of the executor to callAfterTriggerBeginQuery/AfterTriggerEndQuery for themselves, as this is nowdone by ExecutorStart/ExecutorFinish respectively. If you really need tosuppress that and do it for yourself, pass EXEC_FLAG_SKIP_TRIGGERS toExecutorStart.Also, refactor portal commit processing to allow for the possibility thatPortalDrop will invoke user-defined code. I think this is not actuallynecessary just yet, since the portal-execution-strategy logic forces anynon-pure-SELECT query to be run to completion before we will considercommitting. But it seems like good future-proofing.1 parent67a5e72 commita874fe7
File tree
21 files changed
+350
-222
lines changed- contrib
- auto_explain
- pg_stat_statements
- src
- backend
- access/transam
- commands
- executor
- tcop
- utils/mmgr
- include
- executor
- nodes
- utils
- test/regress
- expected
- sql
21 files changed
+350
-222
lines changedLines changed: 28 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
| 43 | + | |
43 | 44 |
| |
44 | 45 |
| |
45 | 46 |
| |
| |||
53 | 54 |
| |
54 | 55 |
| |
55 | 56 |
| |
| 57 | + | |
56 | 58 |
| |
57 | 59 |
| |
58 | 60 |
| |
| |||
132 | 134 |
| |
133 | 135 |
| |
134 | 136 |
| |
| 137 | + | |
| 138 | + | |
135 | 139 |
| |
136 | 140 |
| |
137 | 141 |
| |
| |||
145 | 149 |
| |
146 | 150 |
| |
147 | 151 |
| |
| 152 | + | |
148 | 153 |
| |
149 | 154 |
| |
150 | 155 |
| |
| |||
211 | 216 |
| |
212 | 217 |
| |
213 | 218 |
| |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
214 | 242 |
| |
215 | 243 |
| |
216 | 244 |
| |
|
Lines changed: 28 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
122 | 122 |
| |
123 | 123 |
| |
124 | 124 |
| |
| 125 | + | |
125 | 126 |
| |
126 | 127 |
| |
127 | 128 |
| |
| |||
173 | 174 |
| |
174 | 175 |
| |
175 | 176 |
| |
| 177 | + | |
176 | 178 |
| |
177 | 179 |
| |
178 | 180 |
| |
| |||
269 | 271 |
| |
270 | 272 |
| |
271 | 273 |
| |
| 274 | + | |
| 275 | + | |
272 | 276 |
| |
273 | 277 |
| |
274 | 278 |
| |
| |||
285 | 289 |
| |
286 | 290 |
| |
287 | 291 |
| |
| 292 | + | |
288 | 293 |
| |
289 | 294 |
| |
290 | 295 |
| |
| |||
549 | 554 |
| |
550 | 555 |
| |
551 | 556 |
| |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
552 | 580 |
| |
553 | 581 |
| |
554 | 582 |
| |
|
Lines changed: 32 additions & 28 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1753 | 1753 |
| |
1754 | 1754 |
| |
1755 | 1755 |
| |
1756 |
| - | |
1757 |
| - | |
1758 |
| - | |
1759 |
| - | |
1760 |
| - | |
1761 |
| - | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
1762 | 1760 |
| |
1763 | 1761 |
| |
1764 | 1762 |
| |
| |||
1768 | 1766 |
| |
1769 | 1767 |
| |
1770 | 1768 |
| |
1771 |
| - | |
1772 |
| - | |
1773 |
| - | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
1774 | 1772 |
| |
1775 |
| - | |
| 1773 | + | |
1776 | 1774 |
| |
1777 | 1775 |
| |
1778 | 1776 |
| |
1779 |
| - | |
1780 |
| - | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
1781 | 1783 |
| |
1782 |
| - | |
1783 |
| - | |
| 1784 | + | |
| 1785 | + | |
1784 | 1786 |
| |
1785 | 1787 |
| |
1786 | 1788 |
| |
| |||
1954 | 1956 |
| |
1955 | 1957 |
| |
1956 | 1958 |
| |
1957 |
| - | |
1958 |
| - | |
1959 |
| - | |
1960 |
| - | |
1961 |
| - | |
1962 |
| - | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
1963 | 1963 |
| |
1964 | 1964 |
| |
1965 | 1965 |
| |
| |||
1969 | 1969 |
| |
1970 | 1970 |
| |
1971 | 1971 |
| |
1972 |
| - | |
1973 |
| - | |
1974 |
| - | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
1975 | 1975 |
| |
1976 |
| - | |
| 1976 | + | |
1977 | 1977 |
| |
1978 | 1978 |
| |
1979 | 1979 |
| |
1980 |
| - | |
1981 |
| - | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
1982 | 1986 |
| |
1983 |
| - | |
1984 |
| - | |
| 1987 | + | |
| 1988 | + | |
1985 | 1989 |
| |
1986 | 1990 |
| |
1987 | 1991 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1463 | 1463 |
| |
1464 | 1464 |
| |
1465 | 1465 |
| |
| 1466 | + | |
1466 | 1467 |
| |
1467 | 1468 |
| |
1468 | 1469 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
| 64 | + | |
| 65 | + | |
64 | 66 |
| |
65 | 67 |
| |
66 | 68 |
| |
67 |
| - | |
68 | 69 |
| |
69 | 70 |
| |
70 | 71 |
| |
|
Lines changed: 6 additions & 19 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
360 | 360 |
| |
361 | 361 |
| |
362 | 362 |
| |
| 363 | + | |
| 364 | + | |
363 | 365 |
| |
364 | 366 |
| |
365 | 367 |
| |
| |||
371 | 373 |
| |
372 | 374 |
| |
373 | 375 |
| |
374 |
| - | |
375 |
| - | |
376 |
| - | |
377 |
| - | |
378 |
| - | |
379 |
| - | |
380 | 376 |
| |
381 | 377 |
| |
382 | 378 |
| |
| |||
392 | 388 |
| |
393 | 389 |
| |
394 | 390 |
| |
395 |
| - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
396 | 395 |
| |
397 | 396 |
| |
398 | 397 |
| |
| |||
401 | 400 |
| |
402 | 401 |
| |
403 | 402 |
| |
404 |
| - | |
405 |
| - | |
406 |
| - | |
407 |
| - | |
408 |
| - | |
409 |
| - | |
410 |
| - | |
411 |
| - | |
412 |
| - | |
413 |
| - | |
414 |
| - | |
415 |
| - | |
416 | 403 |
| |
417 | 404 |
| |
418 | 405 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
726 | 726 |
| |
727 | 727 |
| |
728 | 728 |
| |
729 |
| - | |
730 | 729 |
| |
731 | 730 |
| |
732 |
| - | |
| 731 | + | |
733 | 732 |
| |
734 | 733 |
| |
735 | 734 |
| |
|
Lines changed: 9 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
254 | 254 |
| |
255 | 255 |
| |
256 | 256 |
| |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
257 | 263 |
| |
| 264 | + | |
258 | 265 |
| |
259 | 266 |
| |
260 | 267 |
| |
| |||
264 | 271 |
| |
265 | 272 |
| |
266 | 273 |
| |
267 |
| - | |
| 274 | + | |
268 | 275 |
| |
269 | 276 |
| |
270 | 277 |
| |
| |||
371 | 378 |
| |
372 | 379 |
| |
373 | 380 |
| |
374 |
| - | |
| 381 | + | |
375 | 382 |
| |
376 | 383 |
| |
377 | 384 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3676 | 3676 |
| |
3677 | 3677 |
| |
3678 | 3678 |
| |
3679 |
| - | |
| 3679 | + | |
3680 | 3680 |
| |
3681 |
| - | |
| 3681 | + | |
3682 | 3682 |
| |
3683 | 3683 |
| |
3684 | 3684 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
95 | 95 |
| |
96 | 96 |
| |
97 | 97 |
| |
| 98 | + | |
98 | 99 |
| |
99 | 100 |
| |
100 | 101 |
| |
101 | 102 |
| |
102 | 103 |
| |
103 | 104 |
| |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
104 | 109 |
| |
105 | 110 |
| |
106 | 111 |
| |
|
0 commit comments
Comments
(0)