forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita904abe
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 parent9b9c5f2 commita904abe
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 | |
---|---|---|---|
| |||
166 | 166 |
| |
167 | 167 |
| |
168 | 168 |
| |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
169 | 174 |
| |
170 | 175 |
| |
171 | 176 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2016 | 2016 |
| |
2017 | 2017 |
| |
2018 | 2018 |
| |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
2019 | 2028 |
| |
2020 | 2029 |
| |
2021 | 2030 |
| |
|
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 |
| |
| |||
1253 | 1272 |
| |
1254 | 1273 |
| |
1255 | 1274 |
| |
1256 |
| - | |
| 1275 | + | |
1257 | 1276 |
| |
1258 | 1277 |
| |
1259 | 1278 |
| |
| |||
2323 | 2342 |
| |
2324 | 2343 |
| |
2325 | 2344 |
| |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
2326 | 2350 |
| |
2327 | 2351 |
| |
2328 | 2352 |
| |
| |||
2347 | 2371 |
| |
2348 | 2372 |
| |
2349 | 2373 |
| |
2350 |
| - | |
| 2374 | + | |
2351 | 2375 |
| |
2352 | 2376 |
| |
2353 | 2377 |
| |
| |||
2434 | 2458 |
| |
2435 | 2459 |
| |
2436 | 2460 |
| |
2437 |
| - | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
2438 | 2469 |
| |
2439 | 2470 |
| |
2440 | 2471 |
| |
2441 | 2472 |
| |
2442 | 2473 |
| |
2443 |
| - | |
| 2474 | + | |
2444 | 2475 |
| |
2445 | 2476 |
| |
2446 | 2477 |
| |
| |||
2646 | 2677 |
| |
2647 | 2678 |
| |
2648 | 2679 |
| |
2649 |
| - | |
| 2680 | + | |
2650 | 2681 |
| |
2651 | 2682 |
| |
2652 | 2683 |
| |
| |||
2694 | 2725 |
| |
2695 | 2726 |
| |
2696 | 2727 |
| |
| 2728 | + | |
| 2729 | + | |
| 2730 | + | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
2697 | 2734 |
| |
2698 | 2735 |
| |
2699 | 2736 |
| |
| |||
2937 | 2974 |
| |
2938 | 2975 |
| |
2939 | 2976 |
| |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
2940 | 2981 |
| |
2941 | 2982 |
| |
2942 | 2983 |
| |
|
Lines changed: 17 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1260 | 1260 |
| |
1261 | 1261 |
| |
1262 | 1262 |
| |
1263 |
| - | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
1264 | 1268 |
| |
1265 | 1269 |
| |
1266 | 1270 |
| |
| |||
1351 | 1355 |
| |
1352 | 1356 |
| |
1353 | 1357 |
| |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
1354 | 1370 |
| |
1355 | 1371 |
| |
1356 | 1372 |
| |
|
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 |
| |
| |||
2418 | 2443 |
| |
2419 | 2444 |
| |
2420 | 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 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
2421 | 2495 |
| |
2422 | 2496 |
| |
2423 | 2497 |
| |
|
0 commit comments
Comments
(0)