Re: [GENERAL] xmin increasing within a transaction block? - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: [GENERAL] xmin increasing within a transaction block?
Date
Msg-id 20171106125330.gcozh4ijjrkn6shq@alvherre.pgsql
Whole thread Raw
In response to [GENERAL] xmin increasing within a transaction block?  (Luca Ferrari <fluca1978@infinito.it>)
Responses Re: [GENERAL] xmin increasing within a transaction block?
Re: [GENERAL] xmin increasing within a transaction block?
List 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


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [GENERAL] Naming conventions for column names
Next
From: Vikas Sharma
Date:
Subject: [GENERAL] Postgresql 9.3 service doesn't start on RedHat Linux 6.8