forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9055344
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 parent8bb006a commit9055344
File tree
7 files changed
+106
-8
lines changed- doc/src/sgml/ref
- src
- backend
- catalog
- commands
- test/regress
- expected
- sql
7 files changed
+106
-8
lines changedLines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
123 | 123 |
| |
124 | 124 |
| |
125 | 125 |
| |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
126 | 131 |
| |
127 | 132 |
| |
128 | 133 |
| |
|
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 | |
---|---|---|---|
| |||
1374 | 1374 |
| |
1375 | 1375 |
| |
1376 | 1376 |
| |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
1377 | 1386 |
| |
1378 | 1387 |
| |
1379 | 1388 |
| |
|
Lines changed: 20 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
315 | 315 |
| |
316 | 316 |
| |
317 | 317 |
| |
| 318 | + | |
318 | 319 |
| |
319 | 320 |
| |
320 | 321 |
| |
| |||
345 | 346 |
| |
346 | 347 |
| |
347 | 348 |
| |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
348 | 361 |
| |
349 | 362 |
| |
350 | 363 |
| |
| |||
370 | 383 |
| |
371 | 384 |
| |
372 | 385 |
| |
373 |
| - | |
| 386 | + | |
374 | 387 |
| |
375 | 388 |
| |
376 | 389 |
| |
| |||
571 | 584 |
| |
572 | 585 |
| |
573 | 586 |
| |
574 |
| - | |
575 |
| - | |
| 587 | + | |
| 588 | + | |
576 | 589 |
| |
577 | 590 |
| |
578 | 591 |
| |
| |||
660 | 673 |
| |
661 | 674 |
| |
662 | 675 |
| |
663 |
| - | |
| 676 | + | |
664 | 677 |
| |
665 | 678 |
| |
666 | 679 |
| |
| |||
674 | 687 |
| |
675 | 688 |
| |
676 | 689 |
| |
677 |
| - | |
678 |
| - | |
| 690 | + | |
| 691 | + | |
679 | 692 |
| |
680 | 693 |
| |
681 | 694 |
| |
| |||
691 | 704 |
| |
692 | 705 |
| |
693 | 706 |
| |
694 |
| - | |
| 707 | + | |
695 | 708 |
| |
696 | 709 |
| |
697 | 710 |
| |
|
Lines changed: 17 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
966 | 966 |
| |
967 | 967 |
| |
968 | 968 |
| |
969 |
| - | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
970 | 974 |
| |
971 | 975 |
| |
972 | 976 |
| |
| |||
1058 | 1062 |
| |
1059 | 1063 |
| |
1060 | 1064 |
| |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
1061 | 1077 |
| |
1062 | 1078 |
| |
1063 | 1079 |
| |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2514 | 2514 |
| |
2515 | 2515 |
| |
2516 | 2516 |
| |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
2517 | 2542 |
| |
2518 | 2543 |
| |
2519 | 2544 |
| |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
795 | 795 |
| |
796 | 796 |
| |
797 | 797 |
| |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
798 | 823 |
| |
799 | 824 |
| |
800 | 825 |
| |
|
0 commit comments
Comments
(0)