forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc5660e0
committed
Restrict the use of temporary namespace in two-phase transactions
Attempting to use a temporary table within a two-phase transaction isforbidden for ages. However, there have been uncovered grounds fora couple of other object types and commands which work on temporaryobjects with two-phase commit. In short, trying to create, lock or dropan object on a temporary schema should not be authorized within atwo-phase transaction, as it would cause its state to createdependencies with other sessions, causing all sorts of side effects withthe existing session or other sessions spawned later on trying to usethe same temporary schema name.Regression tests are added to cover all the grounds found, the originalreport mentioned function creation, but monitoring closer there are manyother patterns with LOCK, DROP or CREATE EXTENSION which are involved.One of the symptoms resulting in combining both is that the sessionwhich used the temporary schema is not able to shut down completely,waiting for being able to drop the temporary schema, something that itcannot complete because of the two-phase transaction involved withtemporary objects. In this case the client is able to disconnect butthe session remains alive on the backend-side, potentially blockingconnection backend slots from being used. Other problems reported couldalso involve server crashes.This is back-patched down to v10, which is where9b013dc has introducedMyXactFlags, something that this patch relies on.Reported-by: Alexey BashtanovAuthor: Michael PaquierReviewed-by: Masahiko SawadaDiscussion:https://postgr.es/m/5d910e2e-0db8-ec06-dd5f-baec420513c3@imap.ccBackpatch-through: 101 parentc0d0e54 commitc5660e0
File tree
11 files changed
+278
-18
lines changed- doc/src/sgml/ref
- src
- backend
- access/transam
- catalog
- commands
- include/access
- test
- modules/test_extensions
- expected
- sql
- regress
- expected
- sql
11 files changed
+278
-18
lines changedLines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
98 | 98 |
| |
99 | 99 |
| |
100 | 100 |
| |
101 |
| - | |
102 |
| - | |
103 |
| - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
104 | 104 |
| |
105 | 105 |
| |
106 | 106 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2278 | 2278 |
| |
2279 | 2279 |
| |
2280 | 2280 |
| |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
2281 | 2293 |
| |
2282 | 2294 |
| |
2283 | 2295 |
| |
|
Lines changed: 44 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
192 | 192 |
| |
193 | 193 |
| |
194 | 194 |
| |
| 195 | + | |
195 | 196 |
| |
196 | 197 |
| |
197 | 198 |
| |
| |||
459 | 460 |
| |
460 | 461 |
| |
461 | 462 |
| |
462 |
| - | |
463 |
| - | |
464 |
| - | |
| 463 | + | |
| 464 | + | |
465 | 465 |
| |
466 | 466 |
| |
467 | 467 |
| |
| |||
470 | 470 |
| |
471 | 471 |
| |
472 | 472 |
| |
473 |
| - | |
474 |
| - | |
475 |
| - | |
| 473 | + | |
| 474 | + | |
476 | 475 |
| |
477 | 476 |
| |
478 | 477 |
| |
| |||
482 | 481 |
| |
483 | 482 |
| |
484 | 483 |
| |
485 |
| - | |
| 484 | + | |
486 | 485 |
| |
487 | 486 |
| |
488 | 487 |
| |
| |||
2921 | 2920 |
| |
2922 | 2921 |
| |
2923 | 2922 |
| |
2924 |
| - | |
2925 |
| - | |
2926 |
| - | |
| 2923 | + | |
| 2924 | + | |
2927 | 2925 |
| |
2928 | 2926 |
| |
2929 | 2927 |
| |
| |||
2986 | 2984 |
| |
2987 | 2985 |
| |
2988 | 2986 |
| |
2989 |
| - | |
2990 |
| - | |
2991 |
| - | |
| 2987 | + | |
| 2988 | + | |
2992 | 2989 |
| |
2993 | 2990 |
| |
2994 | 2991 |
| |
| |||
3002 | 2999 |
| |
3003 | 3000 |
| |
3004 | 3001 |
| |
3005 |
| - | |
| 3002 | + | |
3006 | 3003 |
| |
3007 | 3004 |
| |
3008 | 3005 |
| |
| |||
3832 | 3829 |
| |
3833 | 3830 |
| |
3834 | 3831 |
| |
| 3832 | + | |
| 3833 | + | |
| 3834 | + | |
| 3835 | + | |
| 3836 | + | |
| 3837 | + | |
| 3838 | + | |
| 3839 | + | |
| 3840 | + | |
| 3841 | + | |
| 3842 | + | |
| 3843 | + | |
| 3844 | + | |
| 3845 | + | |
| 3846 | + | |
| 3847 | + | |
| 3848 | + | |
| 3849 | + | |
| 3850 | + | |
| 3851 | + | |
| 3852 | + | |
| 3853 | + | |
| 3854 | + | |
| 3855 | + | |
| 3856 | + | |
| 3857 | + | |
| 3858 | + | |
| 3859 | + | |
| 3860 | + | |
| 3861 | + | |
| 3862 | + | |
| 3863 | + | |
3835 | 3864 |
| |
3836 | 3865 |
| |
3837 | 3866 |
| |
| |||
4275 | 4304 |
| |
4276 | 4305 |
| |
4277 | 4306 |
| |
4278 |
| - | |
| 4307 | + | |
4279 | 4308 |
| |
4280 | 4309 |
| |
4281 | 4310 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| 17 | + | |
17 | 18 |
| |
18 | 19 |
| |
19 | 20 |
| |
| |||
107 | 108 |
| |
108 | 109 |
| |
109 | 110 |
| |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
110 | 118 |
| |
111 | 119 |
| |
112 | 120 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1475 | 1475 |
| |
1476 | 1476 |
| |
1477 | 1477 |
| |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
1478 | 1485 |
| |
1479 | 1486 |
| |
1480 | 1487 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| 17 | + | |
17 | 18 |
| |
18 | 19 |
| |
19 | 20 |
| |
| |||
83 | 84 |
| |
84 | 85 |
| |
85 | 86 |
| |
| 87 | + | |
86 | 88 |
| |
87 | 89 |
| |
88 | 90 |
| |
| |||
100 | 102 |
| |
101 | 103 |
| |
102 | 104 |
| |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
103 | 113 |
| |
104 | 114 |
| |
105 | 115 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
98 | 98 |
| |
99 | 99 |
| |
100 | 100 |
| |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
101 | 106 |
| |
102 | 107 |
| |
103 | 108 |
| |
|
Lines changed: 33 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
121 | 121 |
| |
122 | 122 |
| |
123 | 123 |
| |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + |
Lines changed: 29 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
64 | 64 |
| |
65 | 65 |
| |
66 | 66 |
| |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + |
Lines changed: 71 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
301 | 301 |
| |
302 | 302 |
| |
303 | 303 |
| |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + |
0 commit comments
Comments
(0)