Complete PostgreSQL Concurrent Upsert Support for All Primary Key Types
メンテナーはふだん 8 日以内に返信
@aaronburtle がすでに取り組んでいます。
2026年9月1日 から。
評価
この issue はまだ評価されていません。
説明
Extend PostgreSQL concurrent PUT/PATCH upsert handling to cover every primary-key type supported by DAB, including composite keys and values with multiple database-equivalent representations. Ensure requests targeting the same logical key acquire the same transaction-scoped lock, use PostgreSQL-native comparison semantics, and complete without duplicate-key conflicts or lost updates. Add focused unit and PostgreSQL integration coverage for the supported type matrix, verifying that one concurrent request inserts while subsequent requests update successfully.
PostgreSQL normally protects existing rows with row-level locks. That is insufficient for an upsert race because, when two requests check for a missing key, there is no row to lock. Both requests can conclude that an insert is required, and one then fails against the unique constraint.
DAB uses transaction-scoped PostgreSQL advisory locks to serialize that sequence:
Derive a deterministic lock identity from the entity and primary key.
Acquire pg_advisory_xact_lock(...).
Recheck whether the row exists.
Insert or update as appropriate.
Release the lock automatically when the transaction commits or rolls back.
Requests for the same logical key must derive the same advisory lock, while requests for different keys should ideally continue concurrently.
The complication is that PostgreSQL equality is type-specific. Different request values can represent the same database key, for example:
character(n) values that differ only by trailing spaces
Numerically equivalent representations such as 1, 1.0, or 1.00
UUIDs with different casing or formatting
Timestamps representing the same instant with different offsets
Composite keys containing any combination of these types
If DAB hashes the raw request text, two database-equal values may acquire different locks. They can then race despite advisory locking. Parameter typing also matters: sending a fixed-width character key as PostgreSQL text can cause an existence predicate to use text equality instead of the column’s native character(n) semantics.
This work is needed to ensure lock identities and post-lock comparisons follow PostgreSQL’s native type semantics for every supported primary-key type. A coarse source-level lock is a safe fallback but serializes unrelated rows; type-aware, key-scoped locks preserve correctness with better concurrency.
- 主要言語
- C#
- スター
- 1.5k
- フォーク
- 371
- 平均マージ
- 8日 19時間
- マージ済み PR(30日)
- 10
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/data-api-builder のほかの issue
-
pgsql
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3598 ·
メンテナーはふだん 8 日以内に返信
-
2.x cli mcp-server
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3576 ·
メンテナーはふだん 8 日以内に返信
-
2.x health-endpoint
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3570 ·
メンテナーはふだん 8 日以内に返信
-
2.x telemetry
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3564 ·
メンテナーはふだん 8 日以内に返信
-
2.x telemetry
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Azure/data-api-builder#3562 ·
メンテナーはふだん 8 日以内に返信
Azure/data-api-builder の issue をすべて見る
似ている issue
-
[Simple] NavigationBar primary commands do not render AppBarButton.Content when it is a UIElementオープンcontrol/navigationbar kind/bug triage/untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
unoplatform/uno.toolkit.ui#1652 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
microsoft/copilot-camp#1053 ·
メンテナーはふだん 1 日以内に返信
-
bug effort:S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
nightscout/nocturne#1861 ·
メンテナーはふだん 1 日以内に返信
-
agentic-workflows area/Docs partner/agentic-workflows
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/fluentui-blazor#5364 ·
メンテナーはふだん 1 日以内に返信