Re: How to safely compare transaction id?

From: alphax <alphax(at)vip(dot)163(dot)com>
To: pg-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to safely compare transaction id?
Date: 2008-01-12 05:07:05
Message-ID: 47884AF9.5000407@vip.163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Marko Kreen wrote:
> On 1/11/08, alphax <alphax(at)vip(dot)163(dot)com> wrote:
>> I want to compare the record's transaction id in sql statements or
>> PL/pgSQL stored procedure. Are there any system function or operator can
>> safely(transaction id wraparound safed) compare the transaction id?
>
> In 8.3 there are txid functions that export 8byte wraparound-safe
> transaction id, that can be safely stored in user tables:
>
> http://developer.postgresql.org/pgdocs/postgres/functions-info.html#FUNCTIONS-TXID-SNAPSHOT
>
>
> For 8.2 and below you can get them as external module from
> Skytools package: http://pgfoundry.org/projects/skytools
>

Thanks. Actually, I want to compares the system columns(xmin, xmax,
ctid) with the tid returned by txid functions declared in

http://developer.postgresql.org/pgdocs/postgres/functions-info.html#FUNCTIONS-TXID-SNAPSHOT

I want to determines a given record which visible to current transaction
whether or not be updated after some time point, that time point is
indicated by aother transaction id started and committed in past time.
How can I safely do that?

By the way, Can I think that the value of system column "ctid" of an
record is the logical "current version" of that record, and used to
compare with txid returned by "FUNCTIONS-TXID-SNAPSHOT"?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message henry 2008-01-12 06:54:47 tcp_keepalives_idle ignored
Previous Message Tom Lane 2008-01-12 00:44:18 Re: oddly slow query