Re: xmin increasing within a transaction block?

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Luca Ferrari <fluca1978(at)infinito(dot)it>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: xmin increasing within a transaction block?
Date: 2017-11-06 12:53:30
Message-ID: 20171106125330.gcozh4ijjrkn6shq@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Luca Ferrari wrote:
> Hi all,
> I suspect this has a trivial explaination, but this is what I'm experiencing:
>
> > CREATE TABLE foo( i int );
> > BEGIN;
> * > INSERT INTO foo(i) VALUES( 1 );
> * > INSERT INTO foo(i) VALUES( 2 );
> * > SELECT xmin, cmin, xmax, cmax, i FROM foo;
> xmin | cmin | xmax | cmax | i
> ------+------+------+------+---
> 2466 | 0 | 0 | 0 | 1
> 2467 | 1 | 0 | 1 | 2
> (2 rows)

With this example both rows show the same xmin to me, which is what I'd
expect.

> Why is xmin greater than the current transaction id (and most notably
> not "fixed")?

Something is using subtransactions there. My first guess would be that
there are triggers with EXCEPTION blocks, but your example doesn't show
any. Or maybe you have event triggers.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vikas Sharma 2017-11-06 13:28:45 Postgresql 9.3 service doesn't start on RedHat Linux 6.8
Previous Message Peter Eisentraut 2017-11-06 12:51:35 Re: Naming conventions for column names