forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit26c89d1
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 parent806f989 commit26c89d1
1 file changed
+33
-35
lines changedLines changed: 33 additions & 35 deletions
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 |
| |
| |||
2630 | 2629 |
| |
2631 | 2630 |
| |
2632 | 2631 |
| |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + | |
2633 | 2637 |
| |
2634 | 2638 |
| |
2635 | 2639 |
| |
| |||
2642 | 2646 |
| |
2643 | 2647 |
| |
2644 | 2648 |
| |
| 2649 | + | |
2645 | 2650 |
| |
2646 |
| - | |
2647 | 2651 |
| |
2648 | 2652 |
| |
2649 | 2653 |
| |
2650 |
| - | |
2651 |
| - | |
2652 |
| - | |
2653 |
| - | |
2654 |
| - | |
2655 |
| - | |
2656 |
| - | |
2657 |
| - | |
2658 |
| - | |
2659 |
| - | |
2660 |
| - | |
2661 |
| - | |
2662 |
| - | |
2663 |
| - | |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
2664 | 2657 |
| |
2665 |
| - | |
2666 |
| - | |
2667 |
| - | |
| 2658 | + | |
2668 | 2659 |
| |
2669 | 2660 |
| |
2670 | 2661 |
| |
| |||
2673 | 2664 |
| |
2674 | 2665 |
| |
2675 | 2666 |
| |
| 2667 | + | |
2676 | 2668 |
| |
2677 |
| - | |
2678 | 2669 |
| |
2679 | 2670 |
| |
2680 | 2671 |
| |
2681 |
| - | |
2682 |
| - | |
2683 |
| - | |
2684 |
| - | |
2685 |
| - | |
2686 |
| - | |
2687 |
| - | |
2688 |
| - | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
2689 | 2675 |
| |
2690 |
| - | |
2691 |
| - | |
2692 |
| - | |
| 2676 | + | |
2693 | 2677 |
| |
2694 | 2678 |
| |
2695 | 2679 |
| |
2696 |
| - | |
| 2680 | + | |
2697 | 2681 |
| |
2698 | 2682 |
| |
2699 | 2683 |
| |
2700 | 2684 |
| |
2701 | 2685 |
| |
2702 | 2686 |
| |
| 2687 | + | |
2703 | 2688 |
| |
2704 | 2689 |
| |
2705 | 2690 |
| |
| |||
2744 | 2729 |
| |
2745 | 2730 |
| |
2746 | 2731 |
| |
2747 |
| - | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
| 2735 | + | |
| 2736 | + | |
| 2737 | + | |
2748 | 2738 |
| |
2749 |
| - | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
2750 | 2745 |
| |
2751 | 2746 |
| |
2752 | 2747 |
| |
2753 | 2748 |
| |
2754 | 2749 |
| |
2755 | 2750 |
| |
2756 | 2751 |
| |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
2757 | 2755 |
| |
2758 | 2756 |
| |
2759 | 2757 |
| |
|
0 commit comments
Comments
(0)