Thread: Feature / Enhancement request.

Feature / Enhancement request.

From
Melvin Davidson
Date:
<div class="Section1"><p class="MsoNormal"><span style="color:black">It would really be nice if pg_class were altered
toadd two new columns: relcreatedat & relmoddat. </span><p class="MsoNormal"><span style="color:black">Both would
beof type timestamp. relcreatedat would contain the timestamp the object was created. </span><span
style="color:#0000CC"></span><pclass="MsoNormal"><span style="color:black">Likewise, relmoddat would contain the last
timestampthe object was altered / modified.</span><p class="MsoNormal"><span style="color:black"> </span><p
class="MsoNormal"><spanstyle="color:black">This would be very useful for user tables that are meant to exist for only a
specificlength of time. eg: 1  month.</span><p class="MsoNormal"><span style="color:black">Then a simple:</span><p
class="MsoNormal"><spanstyle="color:black">SELECT relname</span><p class="MsoNormal"><span style="color:black"> FROM
pg_class</span><p class="MsoNormal"><span style="color:black">WHERE current_timestamp::date - relcreatedat::date >
30</span><pclass="MsoNormal"><span style="color:black">     AND relname LIKE ‘tmp_%’;</span><p class="MsoNormal"><span
style="color:black"> </span><pclass="MsoNormal"><span style="color:black">Would show possible expired tables.</span><p
class="MsoNormal"><spanstyle="color:black"> </span><p class="MsoNormal"><span style="color:black">Likewise, relmoddat
wouldbe useful for determining when someone made changes to a table, index, view, etc.</span><p class="MsoNormal"><span
style="color:black"> </span><pclass="MsoNormal"><b><span style="font-size:10.5pt;font-family:Consolas; 
color:blue">Melvin Davidson – DBA</span></b><p class="MsoNormal"> </div><pre>
Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace.
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at abuse@rackspace.com, and delete the original message.
Your cooperation is appreciated.
</pre>

Re: Feature / Enhancement request.

From
Jaime Casanova
Date:
On Tue, Aug 25, 2009 at 11:18 AM, Melvin
Davidson<melvin.davidson@rackspace.com> wrote:
>
> This would be very useful for user tables that are meant to exist for only a
> specific length of time. eg: 1  month.
>

that's a weird concept

>
> Likewise, relmoddat would be useful for determining when someone made
> changes to a table, index, view, etc.
>

i agree it could be useful for auditing porpouses... in fact, in
environments like government it's likely the law who wants such a
functionality...

but instead of new fields we can invent a new catalog for that and we
can use a guc to enable/disable the track of such changes

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157


Re: Feature / Enhancement request.

From
Josh Berkus
Date:
On 8/25/09 9:18 AM, Melvin Davidson wrote:
> 
> 
> It would really be nice if pg_class were altered to add two new columns:
> relcreatedat & relmoddat.

I don't think that altering pg_class would really cover all the various
cases of what people want for auditing functionality.

It would be more useful to be able to put a trigger on various system
tables, so you could record what you wanted.  However, the system tables
are not normal tables to that would not work predictably.

Search on "DDL Triggers" on the mailing lists for previous discussions
of the technical difficulties around this issue.

-- 
Josh Berkus
PostgreSQL Experts Inc.
www.pgexperts.com