Title: Use ON CONFLICT DO SELECT in DB.upsert() with PostgreSQL 19 · Issue #134 · PyGreSQL/PyGreSQL · GitHub
Open Graph Title: Use ON CONFLICT DO SELECT in DB.upsert() with PostgreSQL 19 · Issue #134 · PyGreSQL/PyGreSQL
X Title: Use ON CONFLICT DO SELECT in DB.upsert() with PostgreSQL 19 · Issue #134 · PyGreSQL/PyGreSQL
Description: When there are no columns to update, DB.upsert() runs INSERT ... ON CONFLICT (...) DO NOTHING RETURNING *. If the row already exists, this returns nothing, so upsert() then reads the row with a separate get(). That is a second round trip...
Open Graph Description: When there are no columns to update, DB.upsert() runs INSERT ... ON CONFLICT (...) DO NOTHING RETURNING *. If the row already exists, this returns nothing, so upsert() then reads the row with a sep...
X Description: When there are no columns to update, DB.upsert() runs INSERT ... ON CONFLICT (...) DO NOTHING RETURNING *. If the row already exists, this returns nothing, so upsert() then reads the row with a sep...
Opengraph URL: https://github.com/PyGreSQL/PyGreSQL/issues/134
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Use ON CONFLICT DO SELECT in DB.upsert() with PostgreSQL 19","articleBody":"When there are no columns to update, `DB.upsert()` runs `INSERT ... ON CONFLICT (...) DO NOTHING RETURNING *`. If the row already exists, this returns nothing, so `upsert()` then reads the row with a separate `get()`. That is a second round trip, and another session can change or delete the row in between.\n\nPostgreSQL 19 added `ON CONFLICT ... DO SELECT`, which returns the conflicting row in the same statement:\n\n```sql\nINSERT INTO t AS included (id, v) VALUES (1, 9)\nON CONFLICT (id) DO SELECT RETURNING *\n```\n\nI plan to use `DO SELECT` instead of `DO NOTHING` when the server version is 19 or newer, and keep the current behavior for older servers. The result of `upsert()` does not change.\n","author":{"url":"https://github.com/Cito","@type":"Person","name":"Cito"},"datePublished":"2026-11-22T20:41:24Z","url":"https://github.com/PyGreSQL/PyGreSQL/issues/134"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bd0309de-8037-0858-33f0-643b37ac743b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B944:1C619:1C96F1:28A6EE:6B0467E9 |
| html-safe-nonce | 4889f6f52159bfb50cd400e9a2c834d32e215e7aa2897db961883b204178ac6a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTQ0OjFDNjE5OjFDOTZGMToyOEE2RUU6NkIwNDY3RTkiLCJ2aXNpdG9yX2lkIjoiNjE0MTIyMDUxMDA3MTc4NzI5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6537a862172d65e85f3555f9f965e44a5bc7cc5611bb6f3fb6f990ddcd3d9402 |
| hovercard-subject-tag | issue:6547521835 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PyGreSQL/PyGreSQL/134/issue_layout |
| twitter:image | https://opengraph.githubassets.com/734177b908f2417a286481d2aaa4f6e2096f81d7892c89fc44866b8b80f47fd6/PyGreSQL/PyGreSQL/issues/134 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/734177b908f2417a286481d2aaa4f6e2096f81d7892c89fc44866b8b80f47fd6/PyGreSQL/PyGreSQL/issues/134 |
| og:image:alt | When there are no columns to update, DB.upsert() runs INSERT ... ON CONFLICT (...) DO NOTHING RETURNING *. If the row already exists, this returns nothing, so upsert() then reads the row with a sep... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Cito |
| hostname | github.com |
| expected-hostname | github.com |
| None | 83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f |
| turbo-cache-control | no-preview |
| go-import | github.com/PyGreSQL/PyGreSQL git https://github.com/PyGreSQL/PyGreSQL.git |
| octolytics-dimension-user_id | 60857770 |
| octolytics-dimension-user_login | PyGreSQL |
| octolytics-dimension-repository_id | 51212044 |
| octolytics-dimension-repository_nwo | PyGreSQL/PyGreSQL |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 51212044 |
| octolytics-dimension-repository_network_root_nwo | PyGreSQL/PyGreSQL |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ca4d07a7cef4e4b75f821dc25e7300d80c1450a9 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width