Feature request - ON CONFLICT DO SELECT
Author: ilmariCreated Sep 8, 2026Updated Sep 8, 2026
Labelsenhancementpostgresapi
PostgreSQL 19 adds support for DO SELECT to ON CONFLICT, which lets you retrieve either the inserted row or the existing one without updating it.
The syntax is:
DO SELECT [ FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } ] [ WHERE condition ]the actual expression for what to return goes in the RETURNING clause like usual.
Source: kysely-org/kysely