Search Postgresql Archives

Re: Table create time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

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



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux