public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dmitry Koval <[email protected]>
To: [email protected]
Subject: Re: Assert when executing query on partitioned table
Date: Mon, 29 Dec 2025 11:43:00 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<CAAvxfHciZfHN22y5kgXAGrd8b5Yn7JVpxJ_qFATiXEk_wV-a-w@mail.gmail.com>
<CAAvxfHcN_zqFcY6we158+jMW3ogENAqVBOkYZ1VngvfHUijAcQ@mail.gmail.com>
<[email protected]>
Hi!
I want to send the patch to Commitfest, so the version changed:
[1] -> [2] (for cfbot).
--
With best regards,
Dmitry Koval
Postgres Professional: http://postgrespro.com
From a450b0c085bde7020c9f8056bd45adb2340afc6a Mon Sep 17 00:00:00 2001
From: Koval Dmitry <[email protected]>
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
Attachments:
[text/plain] v2-0001-Replace-invalid-Assert-with-ereport-ERROR.patch (1.5K, ../[email protected]/2-v2-0001-Replace-invalid-Assert-with-ereport-ERROR.patch)
download | inline diff:
From a450b0c085bde7020c9f8056bd45adb2340afc6a Mon Sep 17 00:00:00 2001
From: Koval Dmitry <[email protected]>
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
view thread (6+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Assert when executing query on partitioned table
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox