forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf38903d
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 parent9fb1396 commitf38903d
1 file changed
+33
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
334 | | - | |
| 333 | + | |
335 | 334 | | |
336 | 335 | | |
337 | 336 | | |
| |||
2360 | 2359 | | |
2361 | 2360 | | |
2362 | 2361 | | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
2363 | 2367 | | |
2364 | 2368 | | |
2365 | 2369 | | |
2366 | 2370 | | |
2367 | 2371 | | |
2368 | 2372 | | |
2369 | 2373 | | |
| 2374 | + | |
2370 | 2375 | | |
2371 | | - | |
2372 | 2376 | | |
2373 | 2377 | | |
2374 | 2378 | | |
2375 | | - | |
2376 | | - | |
2377 | | - | |
2378 | | - | |
2379 | | - | |
2380 | | - | |
2381 | | - | |
2382 | | - | |
2383 | | - | |
2384 | | - | |
2385 | | - | |
2386 | | - | |
2387 | | - | |
2388 | | - | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
2389 | 2382 | | |
2390 | | - | |
2391 | | - | |
2392 | | - | |
| 2383 | + | |
2393 | 2384 | | |
2394 | 2385 | | |
2395 | 2386 | | |
| |||
2398 | 2389 | | |
2399 | 2390 | | |
2400 | 2391 | | |
| 2392 | + | |
2401 | 2393 | | |
2402 | | - | |
2403 | 2394 | | |
2404 | 2395 | | |
2405 | 2396 | | |
2406 | | - | |
2407 | | - | |
2408 | | - | |
2409 | | - | |
2410 | | - | |
2411 | | - | |
2412 | | - | |
2413 | | - | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
2414 | 2400 | | |
2415 | | - | |
2416 | | - | |
2417 | | - | |
| 2401 | + | |
2418 | 2402 | | |
2419 | 2403 | | |
2420 | 2404 | | |
2421 | | - | |
| 2405 | + | |
2422 | 2406 | | |
2423 | 2407 | | |
2424 | 2408 | | |
2425 | 2409 | | |
| 2410 | + | |
2426 | 2411 | | |
2427 | 2412 | | |
2428 | 2413 | | |
| |||
2433 | 2418 | | |
2434 | 2419 | | |
2435 | 2420 | | |
2436 | | - | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
2437 | 2427 | | |
2438 | | - | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
2439 | 2434 | | |
2440 | 2435 | | |
2441 | 2436 | | |
2442 | 2437 | | |
2443 | 2438 | | |
2444 | 2439 | | |
2445 | 2440 | | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
2446 | 2444 | | |
2447 | 2445 | | |
2448 | 2446 | | |
| |||
0 commit comments
Comments
(0)