From ef1a0ccd76fefb871a56770c7f7b866a0f62eab9 Mon Sep 17 00:00:00 2001 From: Viktor Holmberg Date: Fri, 28 Nov 2025 22:30:06 +0100 Subject: [PATCH v18 2/3] 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 4c20560c08b..544b6aaa1eb 100644 --- a/doc/src/sgml/ref/insert.sgml +++ b/doc/src/sgml/ref/insert.sgml @@ -859,9 +859,9 @@ INSERT INTO distributors (did, dname) VALUES (11, 'Global Electronics') - Insert a new distributor if the name doesn't match, otherwise return - the existing row. This example uses the excluded - 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 EXCLUDED + table in the WHERE clause to filter results: 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 4d382a04338..ff7063de261 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 ab3c74c6fc5..05eea8dda2c 100644 --- a/src/backend/executor/execPartition.c +++ b/src/backend/executor/execPartition.c @@ -847,8 +847,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