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 小时
- 30 天内合并 PR
- 10
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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
-
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 天内回复
-
.NET triage
难度 2/5 1-3 小时 新手友好度 74/100
microsoft/agent-framework#8811 ·
维护者通常 1 天内回复
-
.NET Docs
难度 1/5 1 小时以内 新手友好度 82/100
getsentry/sentry-dotnet#5637 · 1 条评论 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
QuantConnect/Lean#9842 ·
维护者通常 1 天内回复