forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8d367a4
committed
Fix alias matching in transformLockingClause().
When locking a specific named relation for a FOR [KEY] UPDATE/SHAREclause, transformLockingClause() finds the relation to lock byscanning the rangetable for an RTE with a matching eref->aliasname.However, it failed to account for the visibility rules of a join RTE.If a join RTE doesn't have a user-supplied alias, it will have agenerated eref->aliasname of "unnamed_join" that is not visible as arelation name in the parse namespace. Such an RTE needs to be skipped,otherwise it might be found in preference to a regular base relationwith a user-supplied alias of "unnamed_join", preventing it from beinglocked.In addition, if a join RTE doesn't have a user-supplied alias, butdoes have a join_using_alias, then the RTE needs to be matched usingthat alias rather than the generated eref->aliasname, otherwise amisleading "relation not found" error will be reported rather than a"join cannot be locked" error.Backpatch all the way, except for the second part which only goes backto 14, where JOIN USING aliases were added.Dean Rasheed, reviewed by Tom Lane.Discussion:https://postgr.es/m/CAEZATCUY_KOBnqxbTSPf=7fz9HWPnZ5Xgb9SwYzZ8rFXe7nb=w@mail.gmail.com1 parent82699ed commit8d367a4
3 files changed
+73
-1
lines changedLines changed: 18 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3291 | 3291 |
| |
3292 | 3292 |
| |
3293 | 3293 |
| |
| 3294 | + | |
3294 | 3295 |
| |
3295 | 3296 |
| |
3296 | 3297 |
| |
3297 | 3298 |
| |
3298 |
| - | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
3299 | 3316 |
| |
3300 | 3317 |
| |
3301 | 3318 |
| |
|
Lines changed: 33 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2501 | 2501 |
| |
2502 | 2502 |
| |
2503 | 2503 |
| |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
2504 | 2537 |
| |
2505 | 2538 |
| |
2506 | 2539 |
| |
|
Lines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
520 | 520 |
| |
521 | 521 |
| |
522 | 522 |
| |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
523 | 545 |
| |
524 | 546 |
| |
525 | 547 |
| |
|
0 commit comments
Comments
(0)