forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4eb2611
committed
Remove race condition in pg_get_expr().
Since its introduction, pg_get_expr() has intended to silentlyreturn NULL if called with an invalid relation OID, as can happenwhen scanning the catalogs concurrently with relation drops.However, there is a race condition: we check validity of the OIDat the start, but it could get dropped just afterward, leading tofailures. This is the cause of some intermittent instability we'reseeing in a proposed new test case, and presumably it's a hazard inthe field as well.We can fix this by AccessShareLock-ing the target relation for theduration of pg_get_expr(). Since we don't require any permissionson the target relation, this is semantically a bit undesirable. Butit turns out that the set_relation_column_names() subroutine alreadytakes a transient AccessShareLock on that relation, and has done sincecommit2ffa740 in 2012. Given the lack of complaints about that, itseems like there should be no harm in holding the lock a bit longer.Back-patch to all supported branches.Discussion:https://postgr.es/m/31ddcc01-a71b-4e8c-9948-01d1c47293ca@eisentraut.org1 parent52afe56 commit4eb2611
1 file changed
+33
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
355 | | - | |
356 | | - | |
| 355 | + | |
357 | 356 | | |
358 | 357 | | |
359 | 358 | | |
| |||
2599 | 2598 | | |
2600 | 2599 | | |
2601 | 2600 | | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
2602 | 2606 | | |
2603 | 2607 | | |
2604 | 2608 | | |
| |||
2611 | 2615 | | |
2612 | 2616 | | |
2613 | 2617 | | |
| 2618 | + | |
2614 | 2619 | | |
2615 | | - | |
2616 | 2620 | | |
2617 | 2621 | | |
2618 | 2622 | | |
2619 | | - | |
2620 | | - | |
2621 | | - | |
2622 | | - | |
2623 | | - | |
2624 | | - | |
2625 | | - | |
2626 | | - | |
2627 | | - | |
2628 | | - | |
2629 | | - | |
2630 | | - | |
2631 | | - | |
2632 | | - | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
2633 | 2626 | | |
2634 | | - | |
2635 | | - | |
2636 | | - | |
| 2627 | + | |
2637 | 2628 | | |
2638 | 2629 | | |
2639 | 2630 | | |
| |||
2642 | 2633 | | |
2643 | 2634 | | |
2644 | 2635 | | |
| 2636 | + | |
2645 | 2637 | | |
2646 | | - | |
2647 | 2638 | | |
2648 | 2639 | | |
2649 | 2640 | | |
2650 | | - | |
2651 | | - | |
2652 | | - | |
2653 | | - | |
2654 | | - | |
2655 | | - | |
2656 | | - | |
2657 | | - | |
| 2641 | + | |
| 2642 | + | |
| 2643 | + | |
2658 | 2644 | | |
2659 | | - | |
2660 | | - | |
2661 | | - | |
| 2645 | + | |
2662 | 2646 | | |
2663 | 2647 | | |
2664 | 2648 | | |
2665 | | - | |
| 2649 | + | |
2666 | 2650 | | |
2667 | 2651 | | |
2668 | 2652 | | |
2669 | 2653 | | |
2670 | 2654 | | |
2671 | 2655 | | |
| 2656 | + | |
2672 | 2657 | | |
2673 | 2658 | | |
2674 | 2659 | | |
| |||
2713 | 2698 | | |
2714 | 2699 | | |
2715 | 2700 | | |
2716 | | - | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
2717 | 2707 | | |
2718 | | - | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
2719 | 2714 | | |
2720 | 2715 | | |
2721 | 2716 | | |
2722 | 2717 | | |
2723 | 2718 | | |
2724 | 2719 | | |
2725 | 2720 | | |
| 2721 | + | |
| 2722 | + | |
| 2723 | + | |
2726 | 2724 | | |
2727 | 2725 | | |
2728 | 2726 | | |
| |||
0 commit comments
Comments
(0)