From: Alvaro Herrera Date: Thu, 17 Nov 2022 17:56:11 +0000 (+0100) Subject: Fix MERGE tuple count with DO NOTHING X-Git-Tag: REL_16_BETA1~1294 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6ff5aa129933fbde034c0d21c28cf05e052511f9;p=thirdparty%2Fpostgresql.git Fix MERGE tuple count with DO NOTHING Reporting tuples for which nothing is done is useless and goes against the documented behavior, so don't do it. Backpatch to 15. Reported by: Luca Ferrari Discussion: https://postgr.es/m/CAKoxK+42MmACUh6s8XzASQKizbzrtOGA6G1UjzCP75NcXHsiNw@mail.gmail.com --- diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index 0f357f82217..b7ea953b55f 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2799,7 +2799,7 @@ lmerge_matched: { case TM_Ok: /* all good; perform final actions */ - if (canSetTag) + if (canSetTag && commandType != CMD_NOTHING) (estate->es_processed)++; break;