Re: [GENERAL] Table create time

Поиск
Список
Период
Сортировка
От Melvin Davidson
Тема Re: [GENERAL] Table create time
Дата
Msg-id CANu8Fiyw0zYDEaZuJhABx6o+G_9XFDY_aAu6g5xW-JPMfre7qw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Table create time  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: [GENERAL] Table create time
Re: [GENERAL] Table create time
Список pgsql-general
>you could just create an event trigger looking for CREATE TABLE as filter_value:

I have tried that. Unfortunately, I have been unable to extract the table name from the event because TG_TABLE_NAME is not
available during an event trigger, albeit perhaps I am missing something?
That being said, I still believe it is extra work that could easily be avoided and should be added to the postgresql catalogs simply to be
more feature competitive with  Oracle & SQL Server, as well as a boost to the PostgreSQL community.

On Thu, Aug 31, 2017 at 10:54 AM, Michael Paquier <michael.paquier@gmail.com> wrote:
On Thu, Aug 31, 2017 at 10:21 PM, Melvin Davidson <melvin6925@gmail.com> wrote:
> Wolfgang, as David said, a column in pg_class for the creation time of a table does not exist. I long ago requested that feature as it is
> in other DB's (Oracle & MS SQL Server), but the main reason that it was not done was that no one was interested in doing it.

Is there any need for a column in pg_class for that? You could just
create an event trigger looking for CREATE TABLE as filter_value:
https://www.postgresql.org/docs/9.6/static/sql-createeventtrigger.html
And then have this event trigger just save the timestamp value of
now() in a custom table with the name and/or OID of the relation
involved.
--
Michael



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Table create time
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [GENERAL] Table create time