Re: "xmin" system column

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: "xmin" system column
Дата
Msg-id 20060126215057.GA98274@winnie.fuhr.org
обсуждение исходный текст
Ответ на "xmin" system column  ("Eric B. Ridge" <ebr@tcdi.com>)
Ответы Re: "xmin" system column  ("Eric B. Ridge" <ebr@tcdi.com>)
Список pgsql-general
On Thu, Jan 26, 2006 at 04:19:34PM -0500, Eric B. Ridge wrote:
> Outside of "VACUUM FREEZE", is there any way the "xmin" column in a
> relation can change, assuming of course the tuple is never updated
> again?  I'm considering using this as a way to identify all tuples
> modified in the same transaction (in an effort to group them
> together), and am wondering if there's any way tuples from different
> transactions could end up with the same xmin value.

I don't know about tuples from different transactions having the
same xmin (aside from 1/BootstrapXID and 2/FrozenXID), but tuples
from the same outer transaction could have different xmin values
due to savepoints.

test=> CREATE TABLE foo (x integer);
test=> BEGIN;
test=> INSERT INTO foo VALUES (1);
test=> SAVEPOINT s;
test=> INSERT INTO foo VALUES (2);
test=> RELEASE SAVEPOINT s;
test=> INSERT INTO foo VALUES (3);
test=> COMMIT;
test=> SELECT xmin, * FROM foo;
  xmin  | x
--------+---
 424584 | 1
 424585 | 2
 424584 | 3
(3 rows)

Explicit savepoints aren't the only way to get this effect; you'll
also see it if the savepoint is implicit, as when trapping errors
in a function.

--
Michael Fuhr

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: "xmin" system column
Следующее
От: Bob Pawley
Дата:
Сообщение: Re: Arrays