Skip to content

PostgreSQL: Support FOR NO KEY UPDATE and FOR KEY SHARE - #2988

Open
LucaCappelletti94 wants to merge 2 commits into
mainfrom
upstream/pg-row-lock-strengths
Open

LucaCappelletti94 wants to merge 2 commits into
mainfrom
upstream/pg-row-lock-strengths

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

This PR adds NoKeyUpdate and KeyShare, read before the existing OF, NOWAIT and SKIP LOCKED handling. Like FOR UPDATE and FOR SHARE, they parse in every dialect.

@codecov-commenter

codecov-commenter commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.30%. Comparing base (5201fb1) to head (da73352).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2988      +/-   ##
==========================================
+ Coverage   83.29%   83.30%   +0.01%     
==========================================
  Files          42       42              
  Lines       35372    35381       +9     
  Branches    35372    35381       +9     
==========================================
+ Hits        29463    29475      +12     
+ Misses       2456     2453       -3     
  Partials     3453     3453              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MrBisonte MrBisonte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! How parse_lock reads the lock strength after this change:

FOR ─┬─ UPDATE ──────> Update
     ├─ SHARE ─────────> Share
     ├─ NO KEY UPDATE ──-> NoKeyUpdate   new
     └─ KEY SHARE ──────> KeyShare      new
          then  [OF name]  [NOWAIT | SKIP LOCKED]

Small follow up idea, not for this PR: OF only takes one name but Postgres allows a list so FOR UPDATE OF a, b still fails.

@MrBisonte MrBisonte left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong PR please ignore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants