Re: Adding date column to system catalog "pg_database"

From: Shreeyansh Dba <shreeyansh2014(at)gmail(dot)com>
To: pavan95 <pavan(dot)postgresdba(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Adding date column to system catalog "pg_database"
Date: 2018-06-07 11:42:43
Message-ID: CAGDYbUP2ruZ2MXX8SEhCi=wm_evseWHVWuonC=wOcWnOfG1sxA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Pavan,

As pg_database is a system catalog table and you can not add or alter it
even you are superuser.

You can get the database related information which you are looking for
using below query.

SELECT (pg_stat_file('base/'||oid ||'/PG_VERSION')).modification, datname
FROM pg_database;

Hope this helps..

<http://www.shreeyansh.com>

On Thu, Jun 7, 2018 at 4:35 PM, pavan95 <pavan(dot)postgresdba(at)gmail(dot)com> wrote:

> Hi all,
>
> Is it possible to add date column to "pg_database" view by altering the
> table?
>
> Reason is to get the created date of each database, I will schedule a
> trigger to update the date column with current server time. By this I can
> get the db creation date every now from the point of creation of new db.
>
> Any ideas in accomplishment of this task are of great help!
>
> Thanks in advance.
>
>
>
> Regards,
> Pavan
>
>
>
> --
> Sent from: http://www.postgresql-archive.org/PostgreSQL-admin-f2076596.
> html
>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Owayss Kabtoul 2018-06-08 07:24:49 High CPU load caused by the autovacuum launcher process
Previous Message Achilleas Mantzios 2018-06-07 11:14:23 Re: Adding date column to system catalog "pg_database"