Re: xmax not zero? - Mailing list pgsql-general

From Laurenz Albe
Subject Re: xmax not zero?
Date
Msg-id b8e727ca85abb6e36a946c39cd4b1789110390d4.camel@cybertec.at
Whole thread Raw
In response to Re: xmax not zero?  (Guillaume Lelarge <guillaume@lelarge.info>)
List pgsql-general
On Mon, 2023-10-30 at 13:53 +0100, Guillaume Lelarge wrote:
> Le lun. 30 oct. 2023 à 13:45, Luca Ferrari <fluca1978@gmail.com> a écrit :
> > I have a table that presents an xmax not zeroed outside of a
> > transaction block, and it does not look normal to me.
> > I have no idea about how this happened, it is one of my "toy"
> > PostgreSQL virtual machines.
> > But how to dig an better understand why there is an xmax with a non-zero value?
>
> There are many reasons for a non-zero value: row updated or deleted in a rollbacked
> transaction, row updated or deleted in a current transaction, row locked by a
> SELECT FOR UPDATE, and perhaps others I don't remember right now.

INSERT ... ON CONFLICT could also cause this.
As long as the transaction corresponding to the "xid" is marked as "aborted",
that number is not valid and is treated like a 0.

Yours,
Laurenz Albe



pgsql-general by date:

Previous
From: Paul Förster
Date:
Subject: Re: pg_checksums?
Next
From: Ron
Date:
Subject: Re: pg_checksums?