Re: [GENERAL] Table create time - Mailing list pgsql-general

From Charles Clavadetscher
Subject Re: [GENERAL] Table create time
Date
Msg-id 047001d32228$01858480$04908d80$@swisspug.org
Whole thread Raw
In response to [GENERAL] Table create time  (hamann.w@t-online.de)
List 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 by date:

Previous
From: hamann.w@t-online.de
Date:
Subject: [GENERAL] Table create time
Next
From: Achilleas Mantzios
Date:
Subject: Re: [GENERAL] Table create time