Re: [GENERAL] Table create time

Поиск
Список
Период
Сортировка
От Charles Clavadetscher
Тема Re: [GENERAL] Table create time
Дата
Msg-id 047001d32228$01858480$04908d80$@swisspug.org
обсуждение исходный текст
Ответ на [GENERAL] Table create time  (hamann.w@t-online.de)
Список pgsql-general
Hello

> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of hamann.w@t-
> online.de
> Sent: Donnerstag, 31. August 2017 08:56
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] Table create time
>
>
> Hi,
>
> is there a way to add a table create (and perhaps schema modify) timestamp to the system?
> I do occasionally create semi-temporary tables (meant to live until a problem is solved, i.e. longer than a session)
> with conveniently short names.

Unfortunately I can't help with this.

> Also, is there a simple query to identify tables without a table comment? (so a weekly cron could remind me of
> tables that are already a few days old but have no explanatory comment)

Comments are stored in pg_catalog.pg_description. If there is an entry for your table then it has comments, otherwise
not.

Example:

SELECT * FROM pg_description WHERE objoid = to_regclass('survey_control');

 objoid  | classoid | objsubid |
           description 

---------+----------+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 2523030 |     1259 |        0 | Main table for survey management and control.
 2523030 |     1259 |        1 | The name of the survey.
 2523030 |     1259 |        2 | The year of conduction.
[...]

For tables the objsubid is 0 for the table comment and 1..n for column description. The number refers to the position
ofthe column in the table. 

Hope this helps.

Regards
Charles

>
> I am running PG 9.3
>
> Best regards
> Wolfgang Hamann
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general



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

Предыдущее
От: hamann.w@t-online.de
Дата:
Сообщение: [GENERAL] Table create time
Следующее
От: Achilleas Mantzios
Дата:
Сообщение: Re: [GENERAL] Table create time