Re: Determining when a row was inserted

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Determining when a row was inserted
Дата
Msg-id 1117824801.5758.60.camel@state.g2switchworks.com
обсуждение исходный текст
Ответ на Re: Determining when a row was inserted  (Alex Turner <armtuk@gmail.com>)
Ответы Re: Determining when a row was inserted  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Reply at bottom...

On Fri, 2005-06-03 at 13:40, Alex Turner wrote:
> One might even suggest that this should really be a default for all
> tables everywhere, because at some time or another, someone wants to
> know when something got put in the database...
>
> Alex.
>
> On 6/3/05, Wiebe de Jong <wiebedj@shaw.ca> wrote:
>         The way I do it is to add a timestamp field with a default
>         value of now().
>         Unfortunately, this won't help with any records that have
>         already been
>         created.
>
>         Wiebe
>
>         -----Original Message-----
>         From: pgsql-general-owner@postgresql.org
>         [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Terry
>         Lee Tucker
>         Sent: Thursday, June 02, 2005 5:51 AM
>         To: pgsql-general@postgresql.org
>         Subject: Re: [GENERAL] Determining when a row was inserted
>
>         I don't think there is a way to do that. You'll have to create
>         an audit
>         table
>         and a rule to update it or you'll have to add a column to the
>         table and a
>         trigger to update it.
>
>         On Thursday 02 June 2005 01:22 am, Eisenhut, Glenn saith:
>         > Folks - hi
>         >
>         > Is it possible to determine when a row was inserted into a
>         table using the
>         > system catalogs or such. I have the situation where I need
>         to find out
>         when
>         > a user was added to a user table - the table was not setup
>         with a date to
>         > track this.


No, this is a terrible idea as a default.  while I wouldn't mind having
a switch for it, the cost of storing a timestamp AND having to produce
it for each insert is not worth it, since there are just as likely to be
tables no one cares a wit about when they were last changed.

That kind of designing is what leads to bloated, overweight programs...

В списке pgsql-general по дате отправления:

Предыдущее
От: Alex Turner
Дата:
Сообщение: Re: Determining when a row was inserted
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: Determining when a row was inserted