<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/insert-on-conflict-do-select-a-new-feature-in-postgresql-v19-nipree37c" -->

---
title: INSERT ... ON CONFLICT ... DO SELECT: a new feature in...
description: PostgreSQL v19 introduces a new `ON CONFLICT ... DO SELECT` clause for `INSERT` statements. This extends the existing upsert functionality by allowing you to...
canonical: https://daily.dev/posts/insert-on-conflict-do-select-a-new-feature-in-postgresql-v19-nipree37c
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: INSERT ... ON CONFLICT ... DO SELECT: a new feature in PostgreSQL v19 | daily.dev
og:description: PostgreSQL v19 introduces a new `ON CONFLICT ... DO SELECT` clause for `INSERT` statements. This extends the existing upsert functionality by allowing you to...
og:url: https://daily.dev/posts/insert-on-conflict-do-select-a-new-feature-in-postgresql-v19-nipree37c
og:image: https://api.daily.dev/og/posts/nIpreE37C.png
og:image:alt: INSERT ... ON CONFLICT ... DO SELECT: a new feature in PostgreSQL v19
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# INSERT ... ON CONFLICT ... DO SELECT: a new feature in PostgreSQL v19

**[CYBERTEC PostgreSQL](https://daily.dev/sources/cybertec_postgresql)** · 6 min read · 1 upvotes · 0 comments

## Summary

PostgreSQL v19 introduces a new `ON CONFLICT ... DO SELECT` clause for `INSERT` statements. This extends the existing upsert functionality by allowing you to retrieve rows that already existed in the table when a conflict occurs, rather than only returning newly inserted rows. The feature is most useful when combined with `INSERT ... RETURNING` and when tables have generated columns or trigger-modified data. Previously, achieving the same result required either a separate `SELECT` statement or a no-op `DO UPDATE SET col = col` workaround, which had the downside of creating dead rows that VACUUM must later clean up. The post also explains why `INSERT ... ON CONFLICT` is preferred over `MERGE` for concurrent workloads, as `MERGE` can fail with a duplicate key error under concurrent inserts.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.cybertec-postgresql.com/en/insert-on-conflict-do-select-a-new-feature-in-postgresql-v19/>

## Similar posts on daily.dev

- [PostgreSQL 18 - Track What Changed By Your UPSERTs](https://daily.dev/posts/postgresql-18---track-what-changed-by-your-upserts-zaankh94i) · Hashrocket · 9 upvotes · 0 comments

---

Tags: [#database](https://daily.dev/tags/database), [#sql](https://daily.dev/tags/sql), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/insert-on-conflict-do-select-a-new-feature-in-postgresql-v19-nipree37c)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"INSERT ... ON CONFLICT ... DO SELECT: a new feature in PostgreSQL v19","url":"https://daily.dev/posts/insert-on-conflict-do-select-a-new-feature-in-postgresql-v19-nipree37c","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/insert-on-conflict-do-select-a-new-feature-in-postgresql-v19-nipree37c"},"datePublished":"2026-03-03T12:46:55.925Z","dateModified":"2026-03-03T12:47:20.433Z","description":"PostgreSQL v19 introduces a new `ON CONFLICT ... DO SELECT` clause for `INSERT` statements. This extends the existing upsert functionality by allowing you to...","image":"https://media.daily.dev/image/upload/s--0_ODbtD2--/f_auto/v1722860399/public/Placeholder%2008","thumbnailUrl":"https://media.daily.dev/image/upload/s--0_ODbtD2--/f_auto/v1722860399/public/Placeholder%2008","isAccessibleForFree":true,"articleSection":"CYBERTEC PostgreSQL","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"CYBERTEC PostgreSQL","logo":"https://media.daily.dev/image/upload/s--T-0b7qSy--/f_auto/v1720886268/logos/cybertec_postgresql","url":"https://daily.dev/sources/cybertec_postgresql"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/insert-on-conflict-do-select-a-new-feature-in-postgresql-v19-nipree37c","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"database,sql,postgresql","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"CYBERTEC PostgreSQL","item":"https://daily.dev/sources/cybertec_postgresql"},{"@type":"ListItem","position":3,"name":"INSERT ... ON CONFLICT ... DO SELECT: a new feature in PostgreSQL v19"}]}
```

