Обсуждение: Row creation time

Поиск
Список
Период
Сортировка

Row creation time

От
"Najib Abi Fadel"
Дата:
Is there a to get the row creation time if we know it's object ID ??
 
Thx

Re: Row creation time

От
Michael Glaesemann
Дата:
On Nov 24, 2004, at 7:07 PM, Najib Abi Fadel wrote:

> Is there a to get the row creation time if we know it's object ID ??

Only if you have a timestamp column on the table that records the
creation time. For example,

create table foo (
    foo_id serial not null unique
    , created_timestamp timestamptz not null
        default current_timestamp
) without oids;

Some people also like to include a modified_timestamp column, which can
easily be updated via an after update trigger.

hth

Michael Glaesemann
grzm myrealbox com


Re: Row creation time

От
"Najib Abi Fadel"
Дата:
Actually i have an old  table without any timestamp column. I want to know
the creation time of one Row: One way is to look in the postgres dump files
(which could take some time) in order to see the date the Row was inserted.
I was hoping there is another way ....

Thx anyways.


----- Original Message -----
From: "Michael Glaesemann" <grzm@myrealbox.com>
To: "Najib Abi Fadel" <nabifadel@usj.edu.lb>
Cc: "generalpost" <pgsql-general@postgresql.org>
Sent: Wednesday, November 24, 2004 12:40 PM
Subject: Re: [GENERAL] Row creation time


>
> On Nov 24, 2004, at 7:07 PM, Najib Abi Fadel wrote:
>
> > Is there a to get the row creation time if we know it's object ID ??
>
> Only if you have a timestamp column on the table that records the
> creation time. For example,
>
> create table foo (
> foo_id serial not null unique
> , created_timestamp timestamptz not null
> default current_timestamp
> ) without oids;
>
> Some people also like to include a modified_timestamp column, which can
> easily be updated via an after update trigger.
>
> hth
>
> Michael Glaesemann
> grzm myrealbox com
>