Re: Add relcreated (timestamp) column to pg_class catalog to record the time an object was created

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Kevin Grittner <kgrittn(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Add relcreated (timestamp) column to pg_class catalog to record the time an object was created
Date: 2016-04-21 00:50:10
Message-ID: CAKFQuwb_=mZy9DFsabEFhXdtoiYFbw-Jd8BbsLOWUU2AgjstzQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 20, 2016 at 5:30 PM, Melvin Davidson <melvin6925(at)gmail(dot)com>
wrote:

> On Wed, Apr 20, 2016 at 8:01 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
> wrote:
> "I just cannot see that in the following:
> pg_upgrade 9.4 --> 9.5"
> The 9.5 database is the same as the 9.4 one."
>
> You are speaking of the case where relcreatedat did not/does not exist in
> the previous database?
>

​No, your are reading it too literally. If this was added to 9.7 the
correct analogy is that the upgrade from 9.7 to 9.8 causes a new database
to come into existence - and new objects to be created, which are then
populated with existing data.​

I think we need an original creation date, that can be dump/restored using
something like:

CREATE TABLE [...] WITH CREATIONDATE '2016-05-01'

And then a field for the actual time the creating CREATE TABLE ran
independent of the aforementioned CREATIONDATE.

On a serious note I have no problem with this type of implementation. This
is not being put forth as an auditing system so I don't care if malicious
or careless users can plug meaningless dates into their CREATE TABLE
statements. Let those who rely upon this data setup processes to ensure
its accuracy however they wish.

We are also need a field for "last updated" to so that people can recognize
when a objects structure has changed subsequent to its creation - via ALTER
xxx; two of them actually for the same reason as above.

We probably should start tracking which user was logged in when said object
was created and/or altered.

Pretty soon we are building a full blown auditing system one field at a
time...

Speaking blindly here but given that we now have event triggers I'm even
more inclined to simply tell people to setup user-space tables and event
triggers to do whatever they want. Is there any reason that combination
cannot solve the problems being brought up? I get the desirability of
having something in-core but this seems like a perfect problem for which
PGXN should be the solution.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2016-04-21 00:55:12 Re: RLS policy dump/restore failure due to elided type-casts
Previous Message Adrian Klaver 2016-04-21 00:35:56 Re: RLS policy dump/restore failure due to elided type-casts