forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd21690e
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 parent8ead39e commitd21690e
1 file changed
+33
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
351 | | - | |
| 350 | + | |
352 | 351 | | |
353 | 352 | | |
354 | 353 | | |
| |||
2575 | 2574 | | |
2576 | 2575 | | |
2577 | 2576 | | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
2578 | 2582 | | |
2579 | 2583 | | |
2580 | 2584 | | |
2581 | 2585 | | |
2582 | 2586 | | |
2583 | 2587 | | |
2584 | 2588 | | |
| 2589 | + | |
2585 | 2590 | | |
2586 | | - | |
2587 | 2591 | | |
2588 | 2592 | | |
2589 | 2593 | | |
2590 | | - | |
2591 | | - | |
2592 | | - | |
2593 | | - | |
2594 | | - | |
2595 | | - | |
2596 | | - | |
2597 | | - | |
2598 | | - | |
2599 | | - | |
2600 | | - | |
2601 | | - | |
2602 | | - | |
2603 | | - | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
2604 | 2597 | | |
2605 | | - | |
2606 | | - | |
2607 | | - | |
| 2598 | + | |
2608 | 2599 | | |
2609 | 2600 | | |
2610 | 2601 | | |
| |||
2613 | 2604 | | |
2614 | 2605 | | |
2615 | 2606 | | |
| 2607 | + | |
2616 | 2608 | | |
2617 | | - | |
2618 | 2609 | | |
2619 | 2610 | | |
2620 | 2611 | | |
2621 | | - | |
2622 | | - | |
2623 | | - | |
2624 | | - | |
2625 | | - | |
2626 | | - | |
2627 | | - | |
2628 | | - | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
2629 | 2615 | | |
2630 | | - | |
2631 | | - | |
2632 | | - | |
| 2616 | + | |
2633 | 2617 | | |
2634 | 2618 | | |
2635 | 2619 | | |
2636 | | - | |
| 2620 | + | |
2637 | 2621 | | |
2638 | 2622 | | |
2639 | 2623 | | |
2640 | 2624 | | |
| 2625 | + | |
2641 | 2626 | | |
2642 | 2627 | | |
2643 | 2628 | | |
| |||
2648 | 2633 | | |
2649 | 2634 | | |
2650 | 2635 | | |
2651 | | - | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
2652 | 2642 | | |
2653 | | - | |
| 2643 | + | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
| 2648 | + | |
2654 | 2649 | | |
2655 | 2650 | | |
2656 | 2651 | | |
2657 | 2652 | | |
2658 | 2653 | | |
2659 | 2654 | | |
2660 | 2655 | | |
| 2656 | + | |
| 2657 | + | |
| 2658 | + | |
2661 | 2659 | | |
2662 | 2660 | | |
2663 | 2661 | | |
| |||
0 commit comments
Comments
(0)