From a450b0c085bde7020c9f8056bd45adb2340afc6a Mon Sep 17 00:00:00 2001 From: Koval Dmitry Date: Fri, 19 Dec 2025 01:51:07 +0300 Subject: [PATCH v2] Replace invalid Assert with ereport(ERROR, ...) At the time Assert was added, the UPDATE of INSERT ON CONFLICT operation was not supported for partitioned tables. However, support has been added, so need to replace Assert with ereport(ERROR, ...). --- src/backend/executor/nodeModifyTable.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index d131abcd67..f51ffbfc1e 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2810,13 +2810,10 @@ ExecOnConflictUpdate(ModifyTableContext *context, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to concurrent update"))); - /* - * As long as we don't support an UPDATE of INSERT ON CONFLICT for - * a partitioned table we shouldn't reach to a case where tuple to - * be lock is moved to another partition due to concurrent update - * of the partition key. - */ - Assert(!ItemPointerIndicatesMovedPartitions(&tmfd.ctid)); + if (ItemPointerIndicatesMovedPartitions(&tmfd.ctid)) + ereport(ERROR, + errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), + errmsg("tuple to be updated was already moved to another partition due to concurrent update")); /* * Tell caller to try again from the very start. -- 2.43.0