forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitce57143
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 parenta584d03 commitce57143
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 |
| |
| |||
2615 | 2614 |
| |
2616 | 2615 |
| |
2617 | 2616 |
| |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
2618 | 2622 |
| |
2619 | 2623 |
| |
2620 | 2624 |
| |
| |||
2627 | 2631 |
| |
2628 | 2632 |
| |
2629 | 2633 |
| |
| 2634 | + | |
2630 | 2635 |
| |
2631 |
| - | |
2632 | 2636 |
| |
2633 | 2637 |
| |
2634 | 2638 |
| |
2635 |
| - | |
2636 |
| - | |
2637 |
| - | |
2638 |
| - | |
2639 |
| - | |
2640 |
| - | |
2641 |
| - | |
2642 |
| - | |
2643 |
| - | |
2644 |
| - | |
2645 |
| - | |
2646 |
| - | |
2647 |
| - | |
2648 |
| - | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
2649 | 2642 |
| |
2650 |
| - | |
2651 |
| - | |
2652 |
| - | |
| 2643 | + | |
2653 | 2644 |
| |
2654 | 2645 |
| |
2655 | 2646 |
| |
| |||
2658 | 2649 |
| |
2659 | 2650 |
| |
2660 | 2651 |
| |
| 2652 | + | |
2661 | 2653 |
| |
2662 |
| - | |
2663 | 2654 |
| |
2664 | 2655 |
| |
2665 | 2656 |
| |
2666 |
| - | |
2667 |
| - | |
2668 |
| - | |
2669 |
| - | |
2670 |
| - | |
2671 |
| - | |
2672 |
| - | |
2673 |
| - | |
| 2657 | + | |
| 2658 | + | |
| 2659 | + | |
2674 | 2660 |
| |
2675 |
| - | |
2676 |
| - | |
2677 |
| - | |
| 2661 | + | |
2678 | 2662 |
| |
2679 | 2663 |
| |
2680 | 2664 |
| |
2681 |
| - | |
| 2665 | + | |
2682 | 2666 |
| |
2683 | 2667 |
| |
2684 | 2668 |
| |
2685 | 2669 |
| |
2686 | 2670 |
| |
2687 | 2671 |
| |
| 2672 | + | |
2688 | 2673 |
| |
2689 | 2674 |
| |
2690 | 2675 |
| |
| |||
2729 | 2714 |
| |
2730 | 2715 |
| |
2731 | 2716 |
| |
2732 |
| - | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
2733 | 2723 |
| |
2734 |
| - | |
| 2724 | + | |
| 2725 | + | |
| 2726 | + | |
| 2727 | + | |
| 2728 | + | |
| 2729 | + | |
2735 | 2730 |
| |
2736 | 2731 |
| |
2737 | 2732 |
| |
2738 | 2733 |
| |
2739 | 2734 |
| |
2740 | 2735 |
| |
2741 | 2736 |
| |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
2742 | 2740 |
| |
2743 | 2741 |
| |
2744 | 2742 |
| |
|
0 commit comments
Comments
(0)