Re: How to get Transaction Timestamp ?

From: Raghavendra <raghavendra(dot)rao(at)enterprisedb(dot)com>
To: Marti Raudsepp <marti(at)juffo(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to get Transaction Timestamp ?
Date: 2011-09-17 07:09:46
Message-ID: CA+h6AhiSLcc6WhhwXHc+WOzH9jPLk2QLGfZL3YUmcDVdj8duhg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you for your valuable inputs.

Agreed, with the help of two workarounds we can pull the trx-timestamp one
with additional-column/trigger and another with log_line_prefix from
pg_log/logs.

However, I was curious to know any thing stored at Page-Level(like XID) to
help me in getting the transaction timestamp.

--Raghav

On Sat, Sep 17, 2011 at 7:41 AM, Marti Raudsepp <marti(at)juffo(dot)org> wrote:

> On Fri, Sep 16, 2011 at 21:39, Raghavendra
> <raghavendra(dot)rao(at)enterprisedb(dot)com> wrote:
> > We can get a Transaction ID, but not the transaction timestamp when it
> > performed.
>
> Short answer: You can't. Instead, add a new "timestamptz default
> now()" column, that will get you the time of the insert.
>
> If you want the update time, create a BEFORE UPDATE ON x FOR EACH ROW
> trigger on this table to update it.
>
> Regards,
> Marti
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adriano V. Autino 2011-09-17 07:51:52 problem connecting postgresql 9.0 tables from vba
Previous Message Andy Colson 2011-09-17 03:18:59 Re: Apparent Problem With NULL in Restoring pg_dump