Complete PostgreSQL Concurrent Upsert Support for All Primary Key Types
Maintainer antworten meist innerhalb von 7 Tagen
@aaronburtle arbeitet bereits daran.
Seit 01.9.2026.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
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.
- Vorherrschende Sprache
- C#
- Sterne
- 1.5k
- Forks
- 380
- Ø Merge
- 5 T. 11 Std.
- Gemergte PRs (30 T.)
- 4
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Azure/data-api-builder
-
[Bug]: GraphQL fields listed after a fragment spread are silently droppedEvtl. vergeben @hippi345 hat das vor 16 Tagen übernommen. Offenbug triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Azure/data-api-builder#3861 ·
Maintainer antworten meist innerhalb von 7 Tagen
-
pgsql
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Azure/data-api-builder#3598 ·
Maintainer antworten meist innerhalb von 7 Tagen
-
2.x cli mcp-server
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Azure/data-api-builder#3576 ·
Maintainer antworten meist innerhalb von 7 Tagen
-
2.x health-endpoint
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Azure/data-api-builder#3570 ·
Maintainer antworten meist innerhalb von 7 Tagen
-
2.x telemetry
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Azure/data-api-builder#3564 ·
Maintainer antworten meist innerhalb von 7 Tagen
Alle Issues in Azure/data-api-builder
Ähnliche Issues
-
effort:S P3 refactor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
nightscout/nocturne#3243 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
dasher-project/Dasher-Windows#84 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
libnativeapi/nativeapi#21 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 3 Tagen
-
enhancement P3 performance
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
thomhurst/TUnit#7380 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag