Re: Table create time

From: "Charles Clavadetscher" <clavadetscher(at)swisspug(dot)org>
To: <hamann(dot)w(at)t-online(dot)de>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Table create time
Date: 2017-08-31 07:08:32
Message-ID: 047001d32228$01858480$04908d80$@swisspug.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of hamann(dot)w(at)t-
> online.de
> Sent: Donnerstag, 31. August 2017 08:56
> To: pgsql-general(at)postgresql(dot)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 of the 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(at)postgresql(dot)org) To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Achilleas Mantzios 2017-08-31 07:28:07 Re: Table create time
Previous Message hamann.w 2017-08-31 06:56:09 Table create time