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

Noah Misch <noah@leadboat.com>

From: Noah Misch <noah@leadboat.com>
To: Robins Tharakan <tharakan@gmail.com>
Cc: Richard Guo <guofenglinux@gmail.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2025-04-21T04:06:05Z
Lists: pgsql-bugs
On Fri, Apr 11, 2025 at 07:41:33AM -0700, Noah Misch wrote:
> On Fri, Apr 11, 2025 at 10:18:04PM +0930, Robins Tharakan wrote:
> > On Thu, 23 Jan 2025 at 19:42, Richard Guo <guofenglinux@gmail.com> wrote:
> 
> > Repro SQL
> > =========
> > CREATE TEMPORARY TABLE a(b boolean , UNIQUE(b)) ON COMMIT DELETE ROWS ;
> > CREATE TEMP TABLE d() INHERITS(a) ON COMMIT DROP ;
> > ANALYSE;

> --- a/src/backend/commands/vacuum.c
> +++ b/src/backend/commands/vacuum.c
> @@ -657,6 +657,8 @@ vacuum(List *relations, VacuumParams *params, BufferAccessStrategy bstrategy,
>  				if (use_own_xacts)
>  				{
>  					PopActiveSnapshot();
> +					/* standard_ProcessUtility() does CCI if !use_own_xacts */
> +					CommandCounterIncrement();
>  					CommitTransactionCommand();

Pushed: postgr.es/c/2d5350c



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Avoid ERROR at ON COMMIT DELETE ROWS after relhassubclass=f.

  2. Fix data loss at inplace update after heap_update().

  3. Don't lose partitioned table reltuples=0 after relhassubclass=f.