Re: "xmin" system column

Поиск
Список
Период
Сортировка
Искать
От
Eric B. Ridge
Тема
Re: "xmin" system column
Дата
Msg-id
4710D15A-3EF0-4559-A061-27ABB1594BA3@tcdi.com
Ответ на
Список
Дерево обсуждения
"xmin" system column "Eric B. Ridge" <ebr@tcdi.com>
Re: "xmin" system column Michael Fuhr <mike@fuhr.org>
Re: "xmin" system column "Eric B. Ridge" <ebr@tcdi.com>
Re: "xmin" system column Tom Lane <tgl@sss.pgh.pa.us>
Re: "xmin" system column "Eric B. Ridge" <ebr@tcdi.com>
Re: "xmin" system column Michael Fuhr <mike@fuhr.org>
Re: "xmin" system column Michael Fuhr <mike@fuhr.org>
Re: "xmin" system column "Eric B. Ridge" <ebr@tcdi.com>
Re: "xmin" system column Christian Kratzer <ck-lists@cksoft.de>
Re: "xmin" system column "Jim C. Nasby" <jnasby@pervasive.com>
Re: "xmin" system column Tom Lane <tgl@sss.pgh.pa.us>
Re: "xmin" system column Marko Kreen <markokr@gmail.com>
On Jan 26, 2006, at 5:22 PM, Michael Fuhr wrote:
> I suppose a sequence is out of the question?  Too easy to get it
> wrong?

Well, I just wanted to avoid embedding this idea into my  
application.  Would rather Postgres take care of it for me.

> Not in the standard installation, but I think a C function that
> returns GetTopTransactionId() should work.  It's trivial to write
> and examples have been posted before; search the archives.

Hmm.  I also see GetCurrentTransactionStartTimestamp() in xact.h.   
That could work as a mostly-unique identifier.  Its value could  
survive dumps (assuming clock is set correctly!) and a little wrapper  
around it could be used by triggers or by default column values.

Futher reading in xact.c says:
	/*
	 * This is the value of now(), ie, the transaction start time.
	 * This does not change as we enter and exit subtransactions, so we  
don't
	 * keep it inside the TransactionState stack.
	 */
	static TimestampTz xactStartTimestamp;



hahaha, *blush*.  I could just use "now()", right?  pg8.1 docs say  
that now()/CURRENT_TIMESTAMP "return the start time of the current  
transaction; their values do not change during the transaction".  I  
could use a composite of (now(), GetTopTransctionId()) to assume  
batch uniqueness.

eric
В списке pgsql-general по дате отправления
От: vishal saberwal
Дата:
От: Bob Pawley
Дата:
Сообщение: Re: Arrays
FAQ