* ExecUpdateLockMode -- find the appropriate UPDATE tuple lock mode for a * given ResultRelInfo */
| 3500 | * given ResultRelInfo |
| 3501 | */ |
| 3502 | LockTupleMode |
| 3503 | ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo) |
| 3504 | { |
| 3505 | Bitmapset *keyCols; |
| 3506 | Bitmapset *updatedCols; |
| 3507 | |
| 3508 | /* |
| 3509 | * Compute lock mode to use. If columns that are part of the key have not |
| 3510 | * been modified, then we can use a weaker lock, allowing for better |
| 3511 | * concurrency. |
| 3512 | */ |
| 3513 | updatedCols = ExecGetAllUpdatedCols(relinfo, estate); |
| 3514 | keyCols = RelationGetIndexAttrBitmap(relinfo->ri_RelationDesc, |
| 3515 | INDEX_ATTR_BITMAP_KEY); |
| 3516 | |
| 3517 | if (bms_overlap(keyCols, updatedCols)) |
| 3518 | return LockTupleExclusive; |
| 3519 | |
| 3520 | return LockTupleNoKeyExclusive; |
| 3521 | } |
| 3522 | |
| 3523 | /* |
| 3524 | * ExecFindRowMark -- find the ExecRowMark struct for given rangetable index |
no test coverage detected