Re: ERROR: tuple to be updated was already modified by an operation triggered by the current command

From: Robins Tharakan <tharakan(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, noah(at)leadboat(dot)com
Subject: Re: ERROR: tuple to be updated was already modified by an operation triggered by the current command
Date: 2025-04-11 12:48:04
Message-ID: CAEP4nAy1BT52u=yf+GKGgbDMAR3re6mM992DXaaoaZq1XQ5a1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On Thu, 23 Jan 2025 at 19:42, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
> I came across $SUBJECT, which can be reproduced using the queries
> below.

I also stepped a few times on this the past few days. Here's a smaller
repro:

$ grep -l -B100 "tuple to be updated was already modified by an operation
triggered by the current command" */source | xargs -i grep Assertion {}
--java.lang.AssertionError: ANALYZE;
--java.lang.AssertionError: ANALYZE( SKIP_LOCKED);
--java.lang.AssertionError: ANALYZE;
--java.lang.AssertionError: ANALYZE( VERBOSE);
--java.lang.AssertionError: ANALYZE( VERBOSE);

Repro SQL
=========
CREATE TEMPORARY TABLE a(b boolean , UNIQUE(b)) ON COMMIT DELETE ROWS ;
CREATE TEMP TABLE d() INHERITS(a) ON COMMIT DROP ;
ANALYSE;

SQL Output
==========
$ psql postgres -f a.sql
CREATE TABLE
CREATE TABLE
psql:a.sql:6: ERROR: tuple to be updated was already modified by an
operation triggered by the current command

>
> This error happens in heap_inplace_lock(), and git-bisect says the
> first bad commit is:
>
> a07e03fd8fa7daf4d1356f7cb501ffe784ea6257 is the first bad commit

I also arrived at the same commit.

Checking (914ea1c93c0~0) - 914ea1c93c - fail (1)
Checking (914ea1c93c0~10) - d89335eea6 - fail (1)
Checking (914ea1c93c0~30) - b0a4c3e88b - fail (1)
Checking (914ea1c93c0~70) - 57dec20fd4 - fail (1)
.
.
Checking (914ea1c93c0~1688) - a07e03fd8f - fail (1)
Checking (914ea1c93c0~1689) - dbf3f974ee - pass (0)
Surfacing Commit is a07e03fd8fa7daf4d1356f7cb501ffe784ea6257

Found using SQLancer / creduce.
-
robins
https://robins.in

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Noah Misch 2025-04-11 14:41:33 Re: ERROR: tuple to be updated was already modified by an operation triggered by the current command
Previous Message Tom Lane 2025-04-10 18:19:52 Re: BUG #18889: /src/backend/utils/adt/network.c condition is always false