forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitceb224b
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 parent8c5da20 commitceb224b
1 file changed
+33
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
347 | | - | |
348 | | - | |
| 347 | + | |
349 | 348 | | |
350 | 349 | | |
351 | 350 | | |
| |||
2384 | 2383 | | |
2385 | 2384 | | |
2386 | 2385 | | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
2387 | 2391 | | |
2388 | 2392 | | |
2389 | 2393 | | |
2390 | 2394 | | |
2391 | 2395 | | |
2392 | 2396 | | |
2393 | 2397 | | |
| 2398 | + | |
2394 | 2399 | | |
2395 | | - | |
2396 | 2400 | | |
2397 | 2401 | | |
2398 | 2402 | | |
2399 | | - | |
2400 | | - | |
2401 | | - | |
2402 | | - | |
2403 | | - | |
2404 | | - | |
2405 | | - | |
2406 | | - | |
2407 | | - | |
2408 | | - | |
2409 | | - | |
2410 | | - | |
2411 | | - | |
2412 | | - | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
2413 | 2406 | | |
2414 | | - | |
2415 | | - | |
2416 | | - | |
| 2407 | + | |
2417 | 2408 | | |
2418 | 2409 | | |
2419 | 2410 | | |
| |||
2422 | 2413 | | |
2423 | 2414 | | |
2424 | 2415 | | |
| 2416 | + | |
2425 | 2417 | | |
2426 | | - | |
2427 | 2418 | | |
2428 | 2419 | | |
2429 | 2420 | | |
2430 | | - | |
2431 | | - | |
2432 | | - | |
2433 | | - | |
2434 | | - | |
2435 | | - | |
2436 | | - | |
2437 | | - | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
2438 | 2424 | | |
2439 | | - | |
2440 | | - | |
2441 | | - | |
| 2425 | + | |
2442 | 2426 | | |
2443 | 2427 | | |
2444 | 2428 | | |
2445 | | - | |
| 2429 | + | |
2446 | 2430 | | |
2447 | 2431 | | |
2448 | 2432 | | |
2449 | 2433 | | |
| 2434 | + | |
2450 | 2435 | | |
2451 | 2436 | | |
2452 | 2437 | | |
| |||
2457 | 2442 | | |
2458 | 2443 | | |
2459 | 2444 | | |
2460 | | - | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
2461 | 2451 | | |
2462 | | - | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
2463 | 2458 | | |
2464 | 2459 | | |
2465 | 2460 | | |
2466 | 2461 | | |
2467 | 2462 | | |
2468 | 2463 | | |
2469 | 2464 | | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
2470 | 2468 | | |
2471 | 2469 | | |
2472 | 2470 | | |
| |||
0 commit comments
Comments
(0)