Complete PostgreSQL Concurrent Upsert Support for All Primary Key Types
Los mantenedores suelen responder en 1 día
@aaronburtle ya está trabajando en esto.
Desde el 1/9/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- C#
- Estrellas
- 1.5k
- Forks
- 371
- Merge medio
- 7 d 5 h
- PR fusionados (30 d)
- 8
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Azure/data-api-builder
-
pgsql
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3598 ·
Los mantenedores suelen responder en 1 día
-
2.x cli mcp-server
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3576 ·
Los mantenedores suelen responder en 1 día
-
2.x health-endpoint
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3570 ·
Los mantenedores suelen responder en 1 día
-
2.x telemetry
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3564 ·
Los mantenedores suelen responder en 1 día
-
2.x telemetry
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Azure/data-api-builder#3562 ·
Los mantenedores suelen responder en 1 día
Todos los issues de Azure/data-api-builder
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NethermindEth/nethermind#14012 ·
Los mantenedores suelen responder en 1 día
-
dependencies Status: Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
json-schema-org/website#2518 ·
Los mantenedores suelen responder en 1 día
-
agentic-workflows
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
builtbybel/Flyoobe#498 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
builtbybel/CrapFixer#112 ·