v19-0002-DO-SELECT-Fixes-after-Jians-review-of-v-17.patch
application/octet-stream
Filename: v19-0002-DO-SELECT-Fixes-after-Jians-review-of-v-17.patch
Type: application/octet-stream
Part: 1
Message:
Re: ON CONFLICT DO SELECT (take 3)
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v19-0002
Subject: DO SELECT - Fixes after Jians review of v 17
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/insert.sgml | 3 | 3 |
| src/backend/access/heap/heapam.c | 4 | 4 |
| src/backend/executor/execPartition.c | 2 | 2 |
From 93ddddddbb772e44c86259ee68c42fa89df1e103 Mon Sep 17 00:00:00 2001
From: Viktor Holmberg <v@viktorh.net>
Date: Fri, 28 Nov 2025 22:30:06 +0100
Subject: [PATCH v19 2/4] DO SELECT - Fixes after Jians review of v 17
- test comment fix
- clarify a code comment about mapping partition varnos
- heap_lock_tuple comment
---
doc/src/sgml/ref/insert.sgml | 6 +++---
src/backend/access/heap/heapam.c | 8 ++++----
src/backend/executor/execPartition.c | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/doc/src/sgml/ref/insert.sgml b/doc/src/sgml/ref/insert.sgml
index cfc48478733..f6122eeb12e 100644
--- a/doc/src/sgml/ref/insert.sgml
+++ b/doc/src/sgml/ref/insert.sgml
@@ -850,9 +850,9 @@ INSERT INTO distributors (did, dname) VALUES (11, 'Global Electronics')
</programlisting>
</para>
<para>
- Insert a new distributor if the name doesn't match, otherwise return
- the existing row. This example uses the <varname>excluded</varname>
- table in the WHERE clause to filter results:
+ Insert a new distributor if the ID doesn't match, otherwise return
+ the existing row. This example uses the <varname>EXCLUDED</varname>
+ table in the <literal>WHERE</literal> clause to filter results:
<programlisting>
INSERT INTO distributors (did, dname) VALUES (12, 'Micro Devices Inc')
ON CONFLICT (did) DO SELECT WHERE dname = EXCLUDED.dname
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 6daf4a87dec..9d513c5dbb1 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -4651,10 +4651,10 @@ l3:
if (result == TM_Invisible)
{
/*
- * This is possible, but only when locking a tuple for ON CONFLICT
- * UPDATE. We return this value here rather than throwing an error in
- * order to give that case the opportunity to throw a more specific
- * error.
+ * This is possible when locking a tuple for ON CONFLICT UPDATE or ON
+ * CONFLICT DO SELECT. We return this value here rather than throwing
+ * an error in order to give that case the opportunity to throw a more
+ * specific error.
*/
result = TM_Invisible;
goto out_locked;
diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c
index 6aac20d9d15..4b27c4519d2 100644
--- a/src/backend/executor/execPartition.c
+++ b/src/backend/executor/execPartition.c
@@ -979,8 +979,8 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
* For both ON CONFLICT DO UPDATE and ON CONFLICT DO SELECT,
* there may be a WHERE clause. If so, initialize state where
* it will be evaluated, mapping the attribute numbers
- * appropriately. As with onConflictSet, we need to map
- * partition varattnos twice, to catch both the EXCLUDED
+ * appropriately. Like we did for onConflictSet above, we need
+ * to map partition varattnos twice, to catch both the EXCLUDED
* pseudo-relation (INNER_VAR), and the main target relation
* (firstVarno).
*/
--
2.48.1