forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit817a1b8
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 parent21fdfd0 commit817a1b8
File tree
8 files changed
+235
-13
lines changed- doc/src/sgml/ref
- src
- backend
- catalog
- commands
- test/regress
- expected
- sql
8 files changed
+235
-13
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: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
162 | 162 |
| |
163 | 163 |
| |
164 | 164 |
| |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
165 | 170 |
| |
166 | 171 |
| |
167 | 172 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2017 | 2017 |
| |
2018 | 2018 |
| |
2019 | 2019 |
| |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
2020 | 2029 |
| |
2021 | 2030 |
| |
2022 | 2031 |
| |
|
Lines changed: 53 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
438 | 438 |
| |
439 | 439 |
| |
440 | 440 |
| |
| 441 | + | |
441 | 442 |
| |
442 | 443 |
| |
443 | 444 |
| |
| |||
485 | 486 |
| |
486 | 487 |
| |
487 | 488 |
| |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
488 | 501 |
| |
489 | 502 |
| |
490 | 503 |
| |
| |||
494 | 507 |
| |
495 | 508 |
| |
496 | 509 |
| |
497 |
| - | |
| 510 | + | |
498 | 511 |
| |
499 | 512 |
| |
500 | 513 |
| |
| |||
547 | 560 |
| |
548 | 561 |
| |
549 | 562 |
| |
550 |
| - | |
| 563 | + | |
551 | 564 |
| |
552 | 565 |
| |
553 | 566 |
| |
| |||
590 | 603 |
| |
591 | 604 |
| |
592 | 605 |
| |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
593 | 612 |
| |
594 | 613 |
| |
595 | 614 |
| |
| |||
781 | 800 |
| |
782 | 801 |
| |
783 | 802 |
| |
784 |
| - | |
785 |
| - | |
| 803 | + | |
| 804 | + | |
786 | 805 |
| |
787 | 806 |
| |
788 | 807 |
| |
| |||
944 | 963 |
| |
945 | 964 |
| |
946 | 965 |
| |
947 |
| - | |
| 966 | + | |
948 | 967 |
| |
949 | 968 |
| |
950 | 969 |
| |
| |||
955 | 974 |
| |
956 | 975 |
| |
957 | 976 |
| |
958 |
| - | |
| 977 | + | |
959 | 978 |
| |
960 | 979 |
| |
961 | 980 |
| |
962 |
| - | |
| 981 | + | |
963 | 982 |
| |
964 | 983 |
| |
965 | 984 |
| |
| |||
1256 | 1275 |
| |
1257 | 1276 |
| |
1258 | 1277 |
| |
1259 |
| - | |
| 1278 | + | |
1260 | 1279 |
| |
1261 | 1280 |
| |
1262 | 1281 |
| |
| |||
2326 | 2345 |
| |
2327 | 2346 |
| |
2328 | 2347 |
| |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
2329 | 2353 |
| |
2330 | 2354 |
| |
2331 | 2355 |
| |
| |||
2350 | 2374 |
| |
2351 | 2375 |
| |
2352 | 2376 |
| |
2353 |
| - | |
| 2377 | + | |
2354 | 2378 |
| |
2355 | 2379 |
| |
2356 | 2380 |
| |
| |||
2437 | 2461 |
| |
2438 | 2462 |
| |
2439 | 2463 |
| |
2440 |
| - | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
2441 | 2472 |
| |
2442 | 2473 |
| |
2443 | 2474 |
| |
2444 | 2475 |
| |
2445 | 2476 |
| |
2446 |
| - | |
| 2477 | + | |
2447 | 2478 |
| |
2448 | 2479 |
| |
2449 | 2480 |
| |
| |||
2649 | 2680 |
| |
2650 | 2681 |
| |
2651 | 2682 |
| |
2652 |
| - | |
| 2683 | + | |
2653 | 2684 |
| |
2654 | 2685 |
| |
2655 | 2686 |
| |
| |||
2697 | 2728 |
| |
2698 | 2729 |
| |
2699 | 2730 |
| |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
| 2735 | + | |
| 2736 | + | |
2700 | 2737 |
| |
2701 | 2738 |
| |
2702 | 2739 |
| |
| |||
2940 | 2977 |
| |
2941 | 2978 |
| |
2942 | 2979 |
| |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
2943 | 2984 |
| |
2944 | 2985 |
| |
2945 | 2986 |
| |
|
Lines changed: 17 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1235 | 1235 |
| |
1236 | 1236 |
| |
1237 | 1237 |
| |
1238 |
| - | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
1239 | 1243 |
| |
1240 | 1244 |
| |
1241 | 1245 |
| |
| |||
1326 | 1330 |
| |
1327 | 1331 |
| |
1328 | 1332 |
| |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
1329 | 1345 |
| |
1330 | 1346 |
| |
1331 | 1347 |
| |
|
Lines changed: 74 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1435 | 1435 |
| |
1436 | 1436 |
| |
1437 | 1437 |
| |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
1438 | 1463 |
| |
1439 | 1464 |
| |
1440 | 1465 |
| |
| |||
2405 | 2430 |
| |
2406 | 2431 |
| |
2407 | 2432 |
| |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
2408 | 2482 |
| |
2409 | 2483 |
| |
2410 | 2484 |
| |
|
0 commit comments
Comments
(0)