Re: ctid & updates - Mailing list pgsql-general

From Tom Lane
Subject Re: ctid & updates
Date
Msg-id 19781.1023231780@sss.pgh.pa.us
Whole thread Raw
In response to Re: ctid & updates  (Jan Wieck <janwieck@yahoo.com>)
List pgsql-general
Jan Wieck <janwieck@yahoo.com> writes:
> Tom Lane wrote:
>> There's a function called something like currtid that takes the
>> CTID of the possibly-obsoleted row and returns the CTID of its latest
>> updated version.  I believe this is exported because the ODBC driver
>> uses it, so it's unlikely to go away, even though AFAIR it's not
>> documented anywhere.  A risk of using it is that CTID of an updated
>> row cannot be trusted for very long --- once VACUUM has come by,
>> you might find that CTID reassigned to some other row entirely.

>     But  it  should  be  safe within the transaction that did the
>     update,  right?

Sure; VACUUM won't risk deleting tuples that were visible as of the
start of the oldest open transaction, so anything that you found earlier
in the current transaction will surely still be there, even if it's not
the latest committed version anymore.  I wouldn't trust a CTID older
than the current transaction, however.

            regards, tom lane

pgsql-general by date:

Previous
From: "Glen Parker"
Date:
Subject: Char = varchar
Next
From: Tom Lane
Date:
Subject: Re: View vs. Statement Query Plan