forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5b4b07f
committed
Fix concurrent indexing operations with temporary tables
Attempting to use CREATE INDEX, DROP INDEX or REINDEX with CONCURRENTLYon a temporary relation with ON COMMIT actions triggered unexpectederrors because those operations use multiple transactions internally tocomplete their work. Here is for example one confusing error when usingON COMMIT DELETE ROWS:ERROR: index "foo" already contains dataIssues related to temporary relations and concurrent indexing are fixedin this commit by enforcing the non-concurrent path to be taken fortemporary relations even if using CONCURRENTLY, transparently to theuser. Using a non-concurrent path does not matter in practice as lockscannot be taken on a temporary relation by a session different than theone owning the relation, and the non-concurrent operation is moreeffective.The problem exists with REINDEX since v12 with the introduction ofCONCURRENTLY, and with CREATE/DROP INDEX since CONCURRENTLY exists forthose commands. In all supported versions, this caused only confusingerror messages to be generated. Note that with REINDEX, it was alsopossible to issue a REINDEX CONCURRENTLY for a temporary relation ownedby a different session, leading to a server crash.The idea to enforce transparently the non-concurrent code path fortemporary relations comes originally from Andres Freund.Reported-by: Manuel RiggerAuthor: Michael Paquier, Heikki LinnakangasReviewed-by: Andres Freund, Álvaro Herrera, Heikki LinnakangasDiscussion:https://postgr.es/m/CA+u7OA6gP7YAeCguyseusYcc=uR8+ypjCcgDDCTzjQ+k6S9ksQ@mail.gmail.comBackpatch-through: 9.41 parentc8e0e56 commit5b4b07f
File tree
7 files changed
+112
-8
lines changed- doc/src/sgml/ref
- src
- backend
- catalog
- commands
- test/regress
- expected
- sql
7 files changed
+112
-8
lines changedLines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
129 | 129 |
| |
130 | 130 |
| |
131 | 131 |
| |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
132 | 137 |
| |
133 | 138 |
| |
134 | 139 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
58 | 58 |
| |
59 | 59 |
| |
60 | 60 |
| |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 |
| |
62 | 67 |
| |
63 | 68 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1493 | 1493 |
| |
1494 | 1494 |
| |
1495 | 1495 |
| |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
1496 | 1505 |
| |
1497 | 1506 |
| |
1498 | 1507 |
| |
|
Lines changed: 26 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
335 | 335 |
| |
336 | 336 |
| |
337 | 337 |
| |
| 338 | + | |
338 | 339 |
| |
339 | 340 |
| |
340 | 341 |
| |
| |||
371 | 372 |
| |
372 | 373 |
| |
373 | 374 |
| |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
374 | 387 |
| |
375 | 388 |
| |
376 | 389 |
| |
| |||
413 | 426 |
| |
414 | 427 |
| |
415 | 428 |
| |
416 |
| - | |
| 429 | + | |
417 | 430 |
| |
418 | 431 |
| |
419 | 432 |
| |
| |||
457 | 470 |
| |
458 | 471 |
| |
459 | 472 |
| |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
460 | 479 |
| |
461 | 480 |
| |
462 | 481 |
| |
| |||
645 | 664 |
| |
646 | 665 |
| |
647 | 666 |
| |
648 |
| - | |
649 |
| - | |
| 667 | + | |
| 668 | + | |
650 | 669 |
| |
651 | 670 |
| |
652 | 671 |
| |
| |||
814 | 833 |
| |
815 | 834 |
| |
816 | 835 |
| |
817 |
| - | |
| 836 | + | |
818 | 837 |
| |
819 | 838 |
| |
820 | 839 |
| |
| |||
825 | 844 |
| |
826 | 845 |
| |
827 | 846 |
| |
828 |
| - | |
| 847 | + | |
829 | 848 |
| |
830 | 849 |
| |
831 | 850 |
| |
832 |
| - | |
| 851 | + | |
833 | 852 |
| |
834 | 853 |
| |
835 | 854 |
| |
| |||
1107 | 1126 |
| |
1108 | 1127 |
| |
1109 | 1128 |
| |
1110 |
| - | |
| 1129 | + | |
1111 | 1130 |
| |
1112 | 1131 |
| |
1113 | 1132 |
| |
|
Lines changed: 17 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1106 | 1106 |
| |
1107 | 1107 |
| |
1108 | 1108 |
| |
1109 |
| - | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
1110 | 1114 |
| |
1111 | 1115 |
| |
1112 | 1116 |
| |
| |||
1197 | 1201 |
| |
1198 | 1202 |
| |
1199 | 1203 |
| |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
1200 | 1216 |
| |
1201 | 1217 |
| |
1202 | 1218 |
| |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2571 | 2571 |
| |
2572 | 2572 |
| |
2573 | 2573 |
| |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
2574 | 2599 |
| |
2575 | 2600 |
| |
2576 | 2601 |
| |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
825 | 825 |
| |
826 | 826 |
| |
827 | 827 |
| |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
828 | 853 |
| |
829 | 854 |
| |
830 | 855 |
| |
|
0 commit comments
Comments
(0)