Search Postgresql Archives

Re: "xmin" system column

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Eric B. Ridge" <ebr@xxxxxxxx> writes:
> That's what I was afraid of.  I've pondering making a "grouping"  
> column that gets set to "xmin" via an UPDATE trigger.  At least I'd  
> have a constant value that would survive database dumps and reloads.

That will most assuredly NOT work.  You will have XID conflicts if
you reload into a different instance of Postgres, or even within the
same instance once it's been running long enough to wrap XIDs around.

> I really need a way to create a unique identifier at the start of a  
> top-level transaction, and be able to use it via triggers and/or  
> column default values in that or its subtransactions.

The only thing I can see that would work for you is to nextval() some
sequence object at the start of each transaction, and then store its
currval() wherever you need it.  As long as you store int8 not int4 or
xid values, this would be reasonably proof against wraparound issues.

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux